Skip to content
BENIBIX Learn

Cherry-Pick

Development🔀 Version ControlBranches and History

Also known as Cherry Pick

One saved change, picked from a branch and added to yours.

Think of it like

Think of it like taking one cherry from a bowl. You get the one you want, not the whole bowl.

Example

A typo fix sits on Emma's half-done branch. She cherry-picks just that commit onto main and ships it today.

Why it matters

Sometimes one fix cannot wait for a whole branch to finish. A cherry-pick moves only that fix.

Definition

A cherry-pick copies one chosen commit from another branch onto the branch you are on. You name the commit by its code, and Git applies just that change. The rest of the other branch is left alone. It is handy for moving a single urgent fix into the live code. The copied commit gets a new code of its own.

Example code

console
$ git cherry-pick ddc2437
[main 68ba79c] Fix typo
 1 file changed, 1 insertion(+)
One commit is copied to main and gets a new code, 68ba79c.

Common mistake

Cherry-picking lots of commits instead of merging. The same change then sits twice in the history.

Key takeaways

  1. 1
    Just one commit. Pick the change you need.
  2. 2
    By its code. Name the commit you want.
  3. 3
    A new copy. The copy gets its own code.

Learn it properly