Cherry-Pick

๐Ÿ“˜ Git & GitHub ๐Ÿ“— Chapter 25 of 40 ๐Ÿ“‚ Phase 8: Advanced Git ๐Ÿ—“๏ธ 2026 Edition
๐Ÿ“Œ Covered in this chapter: Selecting a Single Commit ยท Cherry-Pick Conflicts ยท Duplicate History Risks

Apply a single specific commit from one branch onto another using git cherry-pick, without merging the entire branch.

1Cherry-Pick โ€” What You'll Learn

Apply a single specific commit from one branch onto another using git cherry-pick, without merging the entire branch.

Here's everything this chapter covers, in the order you'll learn it:

  • What cherry-pick does
  • Selecting one specific commit to apply elsewhere
  • A common use case: applying a bug fix to another branch
  • Handling cherry-pick conflicts
  • Continuing after resolving a conflict
  • Aborting a cherry-pick
  • Cherry-picking multiple commits
  • When cherry-pick is the right tool
  • The risk of duplicate commits in history
2Working Example
๐Ÿ’ป Example: Cherry-Pick
Bash
git cherry-pick 
3Best Practices & Common Pitfalls
๐Ÿ’ก Key things to remember:
  • Cherry-pick creates a NEW commit with the same changes but a different hash โ€” use it sparingly, since overusing it can make history confusing and lead to the same fix appearing 'twice' in different branches.
โ“ Frequently Asked Questions (FAQ)

Q What's the most important thing to understand about cherry-pick?

Focus on: Selecting a Single Commit ยท Cherry-Pick Conflicts ยท Duplicate History Risks. These are the core building blocks this chapter's examples are built around, and they show up repeatedly in later chapters of this course.

Q Is cherry-pick something I'll use often in real projects?

Yes โ€” every concept in this chapter reflects a real, everyday part of professional Git and GitHub workflows, not just a theoretical exercise.

OC
Written by Our Compiler Technical Editorial Team
Reviewed for accuracy ยท Last updated August 2026