gitgit-mergegit-merge-conflict

git merge not possible because of deleted files


I had a pretty big merge conflict which I solved. I cannot commit to resolve the confict, though.

When I want to commit with git commit - m "Resolved conflicts" I get an error like this

error: Merging is not possible because you have unmerged files.

When I look at git status, I can see that in my branch and the merged branch, a file is deleted - which is recognised by git:

enter image description here

You can see that in the both deleted notation.

I cannot - as suggested - add or remove the files. I get the error that the file is missing. This is correct because the file is deleted and therefore not on the file system.

Any ideas?


Solution

  • Alright, finally a solution!

    You have to add every deleted file with the -u flag!

    git add -u <file>
    

    Quote from the docs about this flag:

    -u --update

    Update the index just where it already has an entry matching . This removes as well as modifies index entries to match the working tree, but adds no new files.

    If no is given when -u option is used, all tracked files in the entire working tree are updated (old versions of Git used to limit the update to the current directory and its subdirectories).