Git Pull is Not Possible, Unmerged Files

后端 未结 8 2053
小蘑菇
小蘑菇 2020-12-07 07:47

I\'ve read all of the similar questions on this; it seems that none of the following have worked:

Delete offending files
git reset --hard HEAD
git stash
git          


        
相关标签:
8条回答
  • 2020-12-07 08:29

    Ryan Stewart's answer was almost there. In the case where you actually don't want to delete your local changes, there's a workflow you can use to merge:

    • Run git status. It will give you a list of unmerged files.
    • Merge them (by hand, etc.)
    • Run git commit

    Git will commit just the merges into a new commit. (In my case, I had additional added files on disk, which weren't lumped into that commit.)

    Git then considers the merge successful and allows you to move forward.

    0 讨论(0)
  • 2020-12-07 08:32

    If you ever happen to get this issue after running a git fetch and then git is not allowing you to run git pull because of a merge conflict (both modified / unmerged files, and to make you more frustrated, it won't show you any conflict markers in the file since it's not yet merged). If you do not wish to lose your work, you can do the following.

    stage the file.

    $ git add filename
    

    then stash the local changes.

    $ git stash
    

    pull and update your working directory

    $ git pull
    

    restore your local modified file (git will automatically merge if it can, otherwise resolve it)

    $ git stash pop
    

    Hope it will help.

    0 讨论(0)
提交回复
热议问题