Skip to content
Cherry Pick — Explained with Examples

Cherry Pick — Explained with Examples

DodaTech Updated Jun 15, 2026 2 min read

Cherry pick applies specific commits from one branch to another, allowing selective porting of changes without merging entire branches.

Cherry picking in Git copies a commit’s changes from one branch and applies them as a new commit on another branch. The original commit remains in its source branch. Cherry picking is useful for backporting bug fixes to a release branch, applying a specific feature commit without its branch history, or recovering lost work.

Think of cherry picking like selecting only the ripe cherries from a tree. You do not chop down the whole branch — you pick exactly the fruit you want. Similarly, you grab only the commits you need, leaving the rest of the branch behind.

Cherry picking creates duplicate commits with different hashes. This can complicate future merges, as Git may not recognize the relationship between the original and cherry-picked commit. Use it sparingly and only when a full merge is inappropriate.

# View commits on feature branch
git log --oneline feature-branch
# Output:
# d2e3f4a Fix payment bug
# a1b2c3d Add user dashboard

# Cherry pick just the bug fix to main
git checkout main
git cherry-pick d2e3f4a

# Cherry pick multiple commits
git cherry-pick a1b2c3d d2e3f4a

Common use cases: applying a security patch to multiple maintenance releases, porting a specific fix from develop to release without bringing incomplete features, or undoing an accidental merge on the wrong branch.

Merge, Rebase, Git, Branch

Rebase vs Cherry Pick

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro