What is git cherry-pick?

Git & SDLC Branching Intermediate 2–3 Yrs3–5 Yrs Conceptual 1 min read

Quick Answer

git cherry-pick <sha> takes the changes from one specific commit and applies them as a new commit on your current branch. It's used to pull a single fix from main onto a release branch (or vice versa) without merging everything else.

Cherry-pick copies the change from one commit and applies it to my current branch as a new commit. The typical use is a hotfix: a bug is fixed on main but I need that same fix on the release/2.0 branch that's already in production, and I don't want to bring over everything else that's landed on main. So I cherry-pick just that commit. The thing to be aware of is the change now exists as two different commits, which can produce a conflict if those branches are merged later.

  • Creates a new commit with a new hash — the same change now exists in two places, which can cause conflicts if the branches merge later.
  • Cherry-pick a range with git cherry-pick A^..B.
  • Prefer a proper backport process (merge the fix branch into both targets) where possible; cherry-pick for one-off urgent backports.
  • Conflicts resolve like a merge, then git cherry-pick --continue.