Created
July 20, 2017 19:16
-
-
Save noahpresler/4f5b9632344d95c37dfb8a45340e0a3a to your computer and use it in GitHub Desktop.
Create new branch with old commits before history rewrite
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 checkout -b {NEWBRANCHNAME} staging | |
git log --no-merges noah_messed_up..{OLDBRANCHNAME} --format=format:%H | git cherry-pick --stdin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Make a copy of your repository directory to be safe
Set {NEWBRANCHNAME} to the name of the new branch which will have your changes
Set {OLDBRANCHNAME} to the name of the branch you wish to reset
After running this and dealing with any conflicts, do:
This compares the commits on the new branch to staging. It should only have your commits you want merged.
This will show you the diff between the branches. Make sure its the diff you want in a PR.