Git Merge Conflict - Remote File Deleted, Local File Changed

xylar picture xylar · Jul 25, 2012 · Viewed 17.7k times · Source

I merged in changes from another branch but I am getting conflicts because a file has been deleted on the remote branch but has changes on local branch.

I would like to delete the file - I tried git rm path/to/file but it says file: needs merge. What is the best way of removing the file and committing the merge?

Answer

fork0 picture fork0 · Jul 25, 2012

Try using the --force parameter:

git rm --force <file>

If you want to keep the file in filesystem:

git rm --cached <file>