Vasu Patel logoVasu Patel
← Git Mastery
All chapters in this track
  1. 011. The Mental Model
  2. 022. Essential Setup
  3. 033. Core Daily Workflow
  4. 044. Branching
  5. 055. Merging & Conflict Resolution
  6. 066. Rebasing
  7. 077. Remote Repositories
  8. 088. Stashing
  9. 099. Undoing Things
  10. 1010. Tagging & Versioning
  11. 1111. Cherry-Pick
  12. 1212. Git Bisect & Blame
  13. 1313. Git Hooks
  14. 1414. Submodules
  15. 1515. Team Workflows
  16. 1616. Power Commands & Aliases
  17. 1717. Reflog: The Safety Net
  18. 1818. Practice Tasks
  19. 19Quick Reference Cheatsheet

Chapter 11 of 19

11. Cherry-Pick

Apply a specific commit from one branch to another — without merging the whole branch.

git switch main
git cherry-pick a1b2c3           # apply one commit
git cherry-pick a1b2c3 d4e5f6    # apply multiple commits (oldest first)
git cherry-pick main~3..main     # apply a range

# If conflict
git cherry-pick --continue       # after resolving
git cherry-pick --abort          # cancel entirely
git cherry-pick --skip           # skip this commit, continue range

# Cherry-pick without committing (stage only)
git cherry-pick -n a1b2c3

Real-world uses:

  • Backport a bug fix to an older release branch
  • Grab a feature from a stale branch that won't be merged
  • Pull a specific commit out of a messy branch