git cherry-pick — copy one commit

Watch cherry-pick copy a single commit from another branch onto yours. See why the copied commit gets a new hash (c3').

Scenario

Speed
c1initc2base featurec3fix bugc4feat Ac5feat Bc3'fix bugHEADmainfeature

Branch state

mainc3'◀ HEAD
featurec5

Current step 9/9

$ git cherry-pick c3

Only c3 is copied onto main. Same content but a different parent means a new hash c3'. Use it to grab one commit from another branch.

$ git log --oneline --all

c3' (HEAD -> main) fix bug

c5 (feature) feat B

c4 feat A

c3 fix bug

c2 base feature

c1 init

File content (at HEAD) — app.js @ main

1initc1
2basec2
3fixBugc3'
commit abandoned commitHEAD HEAD

Circles are commits; dimmed circles were abandoned by rebase/reset. A prime (c3') means same content, rewritten hash. In sandbox mode, run commands yourself with the buttons.

git cherry-pick applies one specific commit from another branch onto your current branch. When you need just the bugfix from feature without merging everything else, cherry-pick copies exactly that one commit.

Like rebase, cherry-pick is a copy: the content is identical but the parent becomes your branch's tip, so a new hash is born — shown as c3' here. The original commit stays untouched on its own branch.

Its classic use is propagating hotfixes. When a fix on main also needs to land on a release branch, merging would drag in unrelated changes — cherry-pick brings just the fix. Git Branch Simulator

Frequently asked questions

Why does a cherry-picked commit get a new hash?
Hashes are computed from content plus parent. Cherry-pick rewrites the parent to your tip, so identical content still yields a different hash — original and copy are separate commits.
Can I cherry-pick several commits at once?
Yes: git cherry-pick A B C or a range A..B applies them in order, each becoming its own new commit.
When should I cherry-pick instead of merge?
Merge when you want all of a branch's changes; cherry-pick when you need only one or two specific commits — like porting a hotfix to a release branch.

Other scenarios

Related tools