What Is Git Cherry-Pick? Explained with a Real Developer Example
Need one specific commit from another Git branch without merging everything?
Git Cherry-Pick lets you apply the changes from a selected commit to your current branch. In this video, we'll explore how it works, how to use it, when developers need it, and its benefits and trade-offs through a practical Ruby on Rails development scenario.
You'll learn:
- What Git Cherry-Pick is.
- How it differs from Git Merge.
- How to find and apply a specific commit.
- How developers use it for urgent bug fixes and backports.
- Its benefits, limitations, and potential conflicts.
The scenario runs end to end: you're on feature/payments, a hotfix branch has two commits — the payment validation fix you need and an unrelated checkout UI change you don't. Merging drags both across. Cherry-pick takes just the one.
Worth being precise about what it does: cherry-pick copies the changes a commit introduced and creates a new commit on your current branch. It does not move the original, which stays exactly where it was, and the new commit gets a different hash. That matters later — if you eventually merge the original branch too, the same change can land twice, and repeated cherry-picking makes history harder to read. Conflicts are possible and may need resolving before the operation completes.
CHAPTERS
00:00 — The Hook
00:10 — The Problem
00:25 — What Is Git Cherry-Pick?
00:40 — How It Works
01:00 — Practical Git Commands
01:25 — Benefits and Trade-offs
01:45 — The Takeaway
Watch on YouTube