Move a commit to another branchSeptember 22, 2022
To move the last commit(s) to another branch, first make a new branch (this will include the commits from the current branch):
git branch newbranch
Remove the unwanted commit(s) from the current branch (the command below just removes the latest commit):
git reset --hard HEAD^
N commits, you can use:
git reset --hard HEAD~N
newbranch has the new commit(s) while the current branch no longer does.