Search code examples
gitmergegit-mergegit-status

How to resolve git status "Unmerged paths:"?


I merged branch dog into animal. When I go to commit, I get the following:

Unmerged paths:
(use "git reset HEAD <file>..." to unstage)
(use "git add <file>..." to mark resolution
both deleted:       ../public/images/originals/dog.ai
added by them:      ../public/images/original_files/dog.ai

I had different directory names and file names in each branch. The animal branch has the changes that I want.

When I go to reset the head, it doesn't work. And when I go to take any other git action (remove, checkout, etc), I get a path not found error.

What commands do I need to execute to resolve this?


Solution

  • All you should need to do is:

    # if the file in the right place isn't already committed:
    git add <path to desired file>
    
    # remove the "both deleted" file from the index:
    git rm --cached ../public/images/originals/dog.ai
    
    # commit the merge:
    git commit