Overview
We are humans and humans make mistakes. So let’s figure out how to move commits from one branch to another!
How to do
- Switch to the branch where you want to transfer the commits:
git checkout <target-branch>
2. Execute the git cherry-pick command for each commit you want to transfer:
git cherry-pick a1b2c3d
You can also transfer multiple commits, by using the range:
git cherry - pick < start - commit - hash >^..< end - commit - hash >
That’s it. Don’t forget to remove commits from the original branch.