I am trying to do a git pull origin master
from my server but keep getting the error:
Please move or remove them before you can merge.
There are no untracked files, but it seems like it has issues with the ignored files for some reason.
I tried running a git clean -nd
to see what would be deleted and it lists a whole bunch of files that are ignored in .gitignore
.
How can I fix this so I can do a pull?
If you are getting error like
Try removing the above file manually(Careful). Git will merge this file from master branch.
I just faced the same issue and solved it using the following.First clear tracked files by using :
git clean -d -f
then try git pull origin master
You can view other git clean options by typing git clean -help
If there are too many files to delete, which is actually a case for me. You can also try the following solution:
1) fetch
2) merge with a strategy. For instance this one works for me:
git.exe merge --strategy=ours master
To remove & delete all changes git clean -d -f
Source: Stackoverflow.com