Created
December 23, 2014 20:59
-
-
Save subinkrishna/c82aef8455492a7a2156 to your computer and use it in GitHub Desktop.
Revert a Git merge pushed to origin (from https://coderwall.com/p/o0krbw/undo-a-git-merge-that-has-been-pushed-to-the-server)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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