Last active
August 18, 2016 14:38
-
-
Save BrunoGrandePhD/8422c189c1f5028c2a44dcab86453e65 to your computer and use it in GitHub Desktop.
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
git branch new-master # Assumption: HEAD is pointing to the new commits | |
git checkout master | |
git branch before-revert | |
git revert --no-edit commit_X..master # Revert the commits you want to discard | |
git rebase -i before-revert # Optional: squash all commits except top one to create one revert commit | |
git checkout new-master | |
git rebase master | |
git checkout master | |
git merge new-master | |
git branch -D new-master before-revert |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment