Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (19.4k points)

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

To make a long story short, I had different directory names and file names in each branch. 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?

1 Answer

0 votes
by (27.5k points)

The hint suggests using git reset first to unstage 

$ git reset HEAD <file>

Once you're ready to add the path to the desired file

$ git add <path to desired file>

All you need to do now is remove the "both deleted" file from the index. In order to do that follow the command given below: 

$ git rm --cached ../public/images/originals/dog.ai

Don't forget to commit the changes

$ git commit 

This should work.        

Browse Categories

...