What Is Cherry-Pick?
Cherry-pick copies the changes from one specific commit and applies them as a new commit on your current branch.
Cherry-pick lets you grab a single commit from anywhere in history and reapply it where you are now. It is the tool of choice when you need just one change, not a whole branch, somewhere else, such as backporting a fix to an older release.
What cherry-pick does
Cherry-pick takes the diff introduced by a chosen commit and applies it to your current branch as a brand-new commit with a new hash. The original commit stays where it was; you are duplicating its effect, not moving it.
Cherry-picking a commit
You find the commit you want and apply it to the branch you are on.
git switch release/1.x
git cherry-pick a1b2c3dWhen to use it
Cherry-pick shines for backporting a bug fix to a maintenance branch, pulling one ready change out of an unfinished branch, or applying a hotfix across versions. Because it can create duplicate-looking commits, it is best used deliberately rather than as a routine integration method.
Cherry-pick in CI/CD
In release maintenance, teams often cherry-pick a verified fix from main onto a release branch so it ships in a patch without dragging in unrelated changes. CI then validates the cherry-picked commit on the release branch, confirming the fix applies and passes in that context before it goes out.
Cherry-pick tips
- Use it to backport single fixes to release branches.
- Expect a new commit hash; the change is copied, not moved.
- Resolve conflicts if the target branch differs significantly.
- Let CI re-verify the cherry-picked commit on its new branch.
Key takeaways
- Cherry-pick copies one commit's changes onto your current branch.
- It is ideal for backporting fixes and extracting single changes.
- CI re-verifies the cherry-picked commit on its destination branch.