How do I revert `git fetch upstream; git merge upstream/master`?

This question already has an answer here:

  • Undo a Git merge that hasn't been pushed yet 25 answers

  • Since you have an actual merge commit--because you've been introducing your own changes--you should be able to do:

    git reset --hard HEAD~1
    

    Assuming your last commit was the merge commit in question.


    You can reset your local master branch to the origin/master state (if you haven't push your merge to origin/master ) with :

    git reset --hard origin/master
    

    If that's not possible you can use the reflog :

    git reflog
    

    You can see undoing a git rebase for more details

    链接地址: http://www.djcxy.com/p/16966.html

    上一篇: 如何撤消主分支的合并?

    下一篇: 我该如何恢复`git fetch upstream; 混帐上游/主'?