How to resolve git status “Unmerged paths:”?

后端 未结 2 983
轻奢々
轻奢々 2020-12-12 14:52

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

Unmerged paths:
(use "git reset HEAD ..         


        
相关标签:
2条回答
  • 2020-12-12 15:17

    Another way of dealing with this situation if your files ARE already checked in, and your files have been merged (but not committed, so the merge conflicts are inserted into the file) is to run:

    git reset
    

    This will switch to HEAD, and tell git to forget any merge conflicts, and leave the working directory as is. Then you can edit the files in question (search for the "Updated upstream" notices). Once you've dealt with the conflicts, you can run

    git add -p
    

    which will allow you to interactively select which changes you want to add to the index. Once the index looks good (git diff --cached), you can commit, and then

    git reset --hard
    

    to destroy all the unwanted changes in your working directory.

    0 讨论(0)
  • 2020-12-12 15:24

    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
    
    0 讨论(0)
提交回复
热议问题