uaonrq
Last Updated: February 25, 2016
·
542
· rabovik

Undoing Merges

Good article about undoing merges:
http://git-scm.com/2010/03/02/undoing-merges.html

Summary

  • Undoing a merge without losing history

    $ git revert -m 1 [sha_of_merge_commit]
    Finished one revert.
    [master 88edd6d] Revert "Merge branch 'myBranch'"
  • To re-merge that branch again we need to revert the revert of the merge

    $ git revert 88edd6d
    [master 268e243] Revert "Revert "Merge branch 'myBranch'""

    And optionally re-merge that branch again if it has new commits

    $ git merge myBranch