Skip to content

Instantly share code, notes, and snippets.

@knzm
Created May 31, 2012 13:06
Show Gist options
  • Select an option

  • Save knzm/2843304 to your computer and use it in GitHub Desktop.

Select an option

Save knzm/2843304 to your computer and use it in GitHub Desktop.
How to fix a merge commit when using git
# Before:
#
# * 06071d8 fix
# |
# * 75c9b25 merge
# |\
# | * 34f1259 branch-B
# | |
# * | 5db192c branch-A
# | |
#
# After:
#
# * 75f9219 merge
# |\
# | * 34f1259 branch-B
# | |
# * | 5db192c branch-A
# | |
$ git reset --hard 5db192c
$ git merge -X ours 34f1259 --no-commit
$ git checkout 06071d8 .
$ git commit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment