Home Ask Login Register

Developers Planet

Your answer is one click away!

Norbert D February 2016

Unwanted Automatic Git Merge

The file WindowsFormsControlLibrary/Properties/licenses.licx is in my local repository and by error in the remote repository.

I put *.licx in .gitignore file.

When I use the command git pull, I get this message:

error: Your local changes to the following files would be overwritten by merge:

Please, commit your changes or stash them before you can merge.


I do a commit and I do this:

$ git rm --cached WindowsFormsControlLibrary/Properties/licenses.licx
$ git --skip-worktree WindowsFormsControlLibrary/Properties/licenses.licx
$ git --assume-unchanged WindowsFormsControlLibrary/Properties/licenses.licx
$ git reset --hard HEAD

But the message is the same when I use git pull.

How can I use git pull without having to merge the licenses.licx files?


SnehalK February 2016

Have you updated .gitignore locally ? If so you must check contents of the global gitignore file which sometimes influence your local gitignore.

David Deutsch February 2016

When you did git reset --hard HEAD, you undid the removal of the license file from the cache. Do git rm --cached WindowsFormsControlLibrary/Properties/licenses.licx again, then do a git commit.

To be safe, make a backup copy of your local licenses.licx file before the next step.

When you do your next pull, you will get a merge conflict, since you have removed the file while at the same time someone else has obviously changed it (otherwise you would not be getting the original error). Resolve it using "mine" (or simply remove it from the cache again) and commit.

Note that this will remove the licenses.licx file on other people's machines when they do a git pull.

Post Status

Asked in February 2016
Viewed 3,496 times
Voted 5
Answered 2 times


Leave an answer

Quote of the day: live life