Reputation: 27114
If so, what is the command for that?
Thanks so much SO community!
Upvotes: 1
Views: 105
Reputation: 133098
It seems you already have commited changes that you want to commit again, but on another branch. Then you are looking for git cherry-pick
Upvotes: 0
Reputation: 45672
SO to the rescue Git for beginners: The definitive practical guide
Upvotes: 0
Reputation: 31461
If you have not committed:
git checkout -b newbranch; git commit
If you have committed:
git checkout -b newbranch
If you have committed and not pushed and want to remove them from the old branch:
git checkout -b newbranch; git checkout oldbranch; git reset --hard HEAD^
If you have committed and pushed and want to remove them from the old branch:
git checkout -b newbranch; git checkout oldbranch; git revert HEAD
I strongly recommend reading the Pro Git book. http://progit.org
Upvotes: 5