Pull is not possible because you have unmerged files, git stash doesn't work. Don't want to commit

前端 未结 4 2043
误落风尘
误落风尘 2020-12-23 02:12

I just want to pull. I have changes to disregard, my Gemfile and Gemlock files and I\'d be happy to just overwrite them and just pull. I tried stashing my changes away, this

相关标签:
4条回答
  • 2020-12-23 02:30
    git fetch origin
    git reset --hard origin/master
    git pull
    

    Explanation:

    • Fetch will download everything from another repository, in this case, the one marked as "origin".
    • Reset will discard changes and revert to the mentioned branch, "master" in repository "origin".
    • Pull will just get everything from a remote repository and integrate.

    See documentation at http://git-scm.com/docs.

    0 讨论(0)
  • 2020-12-23 02:37

    You can use git checkout <file> to check out the committed version of the file (thus discarding your changes), or git reset --hard HEAD to throw away any uncommitted changes for all files.

    0 讨论(0)
  • 2020-12-23 02:45

    I've had the same error and I solve it with: git merge -s recursive -X theirs origin/master

    0 讨论(0)
  • 2020-12-23 02:51

    I've tried both these and still get failure due to conflicts. At the end of my patience, I cloned master in another location, copied everything into the other branch and committed it. which let me continue. The "-X theirs" option should have done this for me, but it did not.

    git merge -s recursive -X theirs master

    error: 'merge' is not possible because you have unmerged files. hint: Fix them up in the work tree, hint: and then use 'git add/rm ' as hint: appropriate to mark resolution and make a commit, hint: or use 'git commit -a'. fatal: Exiting because of an unresolved conflict.

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