Skip to content

Instantly share code, notes, and snippets.

@LeeCampbell
Created September 17, 2014 10:39
Show Gist options
  • Save LeeCampbell/a662f4df525f9177c4bc to your computer and use it in GitHub Desktop.
Save LeeCampbell/a662f4df525f9177c4bc to your computer and use it in GitHub Desktop.
Revert a merge that is not at the head
# first get the merge commit hash
git log
# next get off master so you can play safe
git checkout -b RevertFeatureX
# revert the merge. Here "-m 1" says that the index 1 branch is the one to keep (hopefully this is the master/develop branch)
git revert -m 1 94d49c1d6edd3006208400b2de5920c4edff1db3
#This will then throw up a git file editor so you can enter in you commit message.
#I think you can use -n in the above revert call to not perform the commit. In this case I think you would git commit -m "My message here"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment