Cherry-pick

Version Controlintermediate

// Definition

Applying a single specific commit from one branch onto another, by its hash — without merging the whole branch. Used to pull one fix into a release branch, or grab a colleague's commit without their other work. `git cherry-pick <hash>` copies just that change.

// Why it matters

Cherry-pick is how a critical fix (or a test) gets hotfixed into a release branch without dragging along everything else on main. QA cares because it's common in release management — and because a cherry-picked commit is a copy (new hash), which can cause confusion or duplicate-change conflicts if the branches later merge.

// How to test

git log main --oneline          # find the fix's hash
git switch release/2.4
git cherry-pick a1b2c3d          # apply just that commit to the release branch
# note: creates a NEW commit (different hash) — the change now exists twice

// Common mistakes

  • Cherry-picking a commit that depends on earlier commits not present on the target (breaks)
  • Forgetting the picked commit is a copy → duplicate-change conflicts on later merge
  • Using cherry-pick where a proper merge/backport process was needed

// Related terms