What is Cherry-Pick

Cherry-pick takes a single commit from one branch and applies its changes to the current branch. It creates a new commit with the same diff and message but a different parent and therefore a different hash.

How it works

git cherry-pick a1b2c3

Git computes the diff between commit a1b2c3 and its parent, applies that diff to the current working tree, and creates a new commit. The new commit has the current HEAD as its parent, not the original commit's parent.

If the diff conflicts with the current branch, Git pauses and asks for manual resolution, just like during a merge or rebase.

Cherry-pick is conceptually the same operation that rebase performs for each commit — rebase is essentially a sequence of cherry-picks onto a new base.

Why it matters

Cherry-pick is useful for applying a specific bug fix from one branch to another without merging the entire branch. It is common for backporting fixes to release branches. However, it creates duplicate commits (same changes, different hashes), so overuse leads to confusing history. Prefer merge or rebase when integrating full branches.

See How Git Rebase Works for how rebase uses cherry-pick internally.