move commits to another branch
# Note: Any changes not committed will be lost.
git branch newbranch # Create a new branch, saving the desired commits
git reset --hard HEAD~3 # Move master back by 3 commits (Make sure you know how many commits you need to go back)
git checkout newbranch # Go to the new branch that still has the desired commits
3.9
10
git checkout existingbranch
git branch newBranch
git reset --hard HEAD~2 # go back 2 commits on existingBranch
Thank you!
10
0
Are there any code examples left?
New code examples in category TypeScript