Created
August 10, 2017 13:22
-
-
Save ludwigschuster/2963dac2f7c6afeacc063bea89c72f75 to your computer and use it in GitHub Desktop.
move Commits from one Branch to another
This file contains 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 newbranch # Create a new branch, saving the desired commits | |
git reset --hard HEAD~3 # Move master back by 3 commits (GONE from master) | |
git checkout newbranch # Go to the new branch that still has the desired commits | |
git reset --hard a1b2c3d4 | |
# Existing Branch | |
git checkout existingbranch | |
git merge master | |
git checkout master | |
git reset --hard HEAD~3 # Go back 3 commits. You *will* lose uncommitted work. | |
git checkout existingbranch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment