Skip to content
The Git Crypt

/static/cripta/en/ossada/cherry-pick-x/

Menu

GIT-023 · Surgery

git cherry-pick -x

Transplants the commit and leaves a plaque saying where it came from.

A plain cherry-pick transplants a commit onto another branch and erases the trail: new hash, no mention of the original. -x appends to the message a line reading (cherry picked from commit …) — the transplant's plaque of origin.

It is mandatory etiquette for backports to release branches: months later, the line answers where the fix came from and lets you audit what has been ported. The documentation asks for -x only when the original commit is public — otherwise the plaque points at a place that doesn't exist.

$ git cherry-pick -x 7a5b8c9
[release-2.3 f4d9e0a] http: cache de templates em memória
$ git log -1 --format=%b
(cherry picked from commit 7a5b8c95e2d1c8a4b6f3e9d0a7c2b5e8d1f4a6c3)
The transplant, origin engraved in the body.