Watch cherry-pick copy a single commit from another branch onto yours. See why the copied commit gets a new hash (c3').
Scenario
Branch state
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
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