Skip to content

Instantly share code, notes, and snippets.

@subinkrishna
Created December 23, 2014 20:59
Show Gist options
  • Save subinkrishna/c82aef8455492a7a2156 to your computer and use it in GitHub Desktop.
Save subinkrishna/c82aef8455492a7a2156 to your computer and use it in GitHub Desktop.
Just learned that when you accidentally merge on the wrong branch and push, there is a way to change it.
git reset --hard [sha-commit-before-merge]
git push [origin] [branch] --force
This will undo the merge and any commits after the merge, so this is useful if you catch your mistake before any more commits happens.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment