Git Academy

Intermediate · 4 min read

Cherry-pick: take just one commit

Bring a fix from another branch without merging the whole branch.

One commit, or a range

The commit is copied (new hash) on your current branch. A..B takes the commits after A up to B.

Safe
$ git cherry-pick <commit>
$ git cherry-pick <A>..<B>

Keep the origin visible

-x adds “(cherry picked from commit …)” to the message: useful for hotfixes on release branches.

Safe
$ git cherry-pick -x <commit>

Conflicts

Resolve as usual, then continue — or abort to go back.

Safe
$ git cherry-pick --continue
$ git cherry-pick --abort