Created
June 6, 2017 17:30
-
-
Save viktor-evdokimov/156ab9e01840ef6698e9c40962781312 to your computer and use it in GitHub Desktop.
move last commit to the new branch
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
# Moving to a new branch | |
# Unless there are other circumstances involved, this can be easily done by branching and rolling back. | |
# Note: Any changes not committed will be lost. | |
git branch newbranch # Create a new branch, saving the desired commits | |
git reset --hard HEAD~1 # Move master back by 3 commits (GONE from master) | |
git checkout newbranch # Go to the new branch that still has the desired commits | |
#from https://stackoverflow.com/questions/1628563/move-the-most-recent-commits-to-a-new-branch-with-git |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment