How do I delete a Git merge?

This question already has an answer here:

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

  • You can do:

    git reset --hard 628612ac
    

    If you are sure you don't have anything in the current working copy that you will need. This will put the HEAD to the commit you had before the merge. Nothing is actually deleted - the other commits become unreachable and will be garbage collected sometime in the future.

    Another option is to use git-revert :

    git revert -m 1 e90aeed8
    

    This will keep your history. It creates a new commit that reverts everything that e90ae... did.

    Here's a good read about the subject: https://www.kernel.org/pub/software/scm/git/docs/howto/revert-a-faulty-merge.txt

    And also here: http://git-scm.com/2010/03/02/undoing-merges.html

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

    上一篇: 如何删除分支中的合并提交

    下一篇: 我如何删除Git合并?