AI Hints
Home›Git & GitHub Tutorial›Rewriting and Picking
Git & GitHub · Lesson 91 of 144

Cherry-Pick

Copy one commit.

⏱ 2 min read▶ Video at 1:39:33🎓 Free
Watch this lesson in the Git & GitHub courseWatch on YouTube ↗Full Git & GitHub course

Sometimes you want just one commit from another branch, not the whole branch. Maybe an experiment branch has one great fix, and lots of things you don't want. Git cherry pick copies a single commit onto your current branch.

Cherry-Pick
From the video: Cherry-Pick
  • One good commit on another branch
  • You don't want the rest
  • Cherry-pick copies just one

git cherry-pick

The experiment branch has two commits. One colours links on hover, which we like. The other adds scrolling text, which we definitely don't want. We're on main. Git cherry pick, with the hash of the good commit. Git copies it onto main, as a new commit. The log shows it, and the scrolling text stayed behind.

git
git log --oneline -n 2 experiment
6a160a7 (experiment) Add scrolling text
89bc0dc Color links on hover
git cherry-pick 89bc0dc
[main b8158ba] Color links on hover
 Date: Mon Jan 5 09:29:41 2026 +0000
 1 file changed, 1 insertion(+)
git log --oneline -n 2
b8158ba (HEAD -> main) Color links on hover
f63a17a Link to about page

Summary

Git cherry pick, and a hash, copies one commit to your current branch. Use it for single fixes. Next, marking important versions with tags.

Key takeaways
  • git cherry-pick <hash>
  • Copies one commit
  • New hash on your branch
Next up: Tags and Releases — naming versions