Resolving a removed file conflict

GIT, 2015-06-17 00:09:07 UTC

Sometimes a file conflict happens when a collaborator has deleted the file and push it to the repository. In other time, you want to pull it into your local repository.

This is what happen;

$ git pull
remote: Counting objects: 2, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 2 (delta 1), reused 0 (delta 0)
Unpacking objects: 100% (2/2), done.
   7440f2f..abbeb6d  master     -> origin/master
CONFLICT (modify/delete): sample.html deleted in abbeb6d0feb32bc50323710d5c51075ffce159f5 and modified in HEAD. Version HEAD of sample.html left in tree.
Automatic merge failed; fix conflicts and then commit the result.

You can solve this conflict by keeping a local file or remove it.

Keep local file

$ git add sample.html
$ git commit -m "keep sample.html"
[master b02a4f3] keep sample.html
$ git pull
Already up-to-date.

Remove local file

$ git rm sample.html
$ git commit -m "rm sample.html"
$ git pull