If so, what is the command for that?
Thanks so much SO community!
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
SO to the rescue Git for beginners: The definitive practical guide
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