🍒 CHAPTER 7 · GIT CHERRY-PICK
Chef You

Steal the Perfect
Recipe Step

Another branch has one amazing commit you want — but you don't want the whole branch. Cherry-pick lets you grab just that one.

Scene I

One perfect commit

Chef Friend

Chef Bob's experimental branch has 5 commits. Most are messy experiments — but one commit is pure gold: a secret sauce recipe that you want on main.

You don't want to merge the whole branch (too risky). Instead, you cherry-pick just that one commit — copying it to your branch as a new commit.

🍒 CHERRY PICKER Click the commits you want (look for 🍒)
🧪 feature/experiments (Bob's branch)
cherry-pick
🍰 main (your branch)
Cherry-picked!

🎉 Only the best commits

You grabbed exactly the commits you wanted — no mess, no unwanted experiments. Cherry-pick creates new commits with the same changes but different hashes.

Perfect for hotfixes — cherry-pick the fix from one branch to another without merging everything.

$ git cherry-pick e7b2d18
[main f1a2b3c] Add secret sauce recipe
1 file changed, 12 insertions(+)
Epilogue
Cherry-pick is precision surgery.
Take only the commits you need.
Leave the rest behind.

Use it for hotfixes — pick a bug fix from a release branch into main, or vice versa, without merging everything.