0 votes
1 view
in Devops and Agile by (28.1k points)

On my branch, I had some files in .gitignore

On a different branch, those files are not.

I want to merge the different branch into mine, and I don't care if those files are no longer ignored or not.

Unfortunately, I get this:

The following untracked working tree files would be overwritten by merge

How would I modify my pull command to overwrite those files, without me having to find, move or delete those files myself?

1 Answer

0 votes
by (48k points)

The reason for this problem is that you’re not tracking the files locally but there might be a chance that the identical files are tracked by the remote.

So the pull is forcing your system to overwrite the files which are not version controlled. For this you can use:

git add * 

git stash

git pull

These commands will track all the files and remove all changes in files on your local system. And get the files from the server.

Also, you can learn more about frequently used Git commands on Git Tutorial.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !