# Cherry-pick one Git commit onto the intended branch

Canonical: https://githtml.com/guides/git-cherry-pick-one-commit-safely
Published: 2026-11-23
Publisher: WaveTech LLC / gitHtml

Git cherry-pick applies the change introduced by an existing commit and normally records a new commit on your current branch. Verify the source commit, destination branch, and dependencies first. Preserve uncommitted work before starting. Cherry-picking does not move the original commit or guarantee that its change works independently of earlier commits.

## Check whether one commit is enough

Cherry-picking is useful for a focused backport, such as applying a bug fix to a maintained release branch without merging an entire feature branch. The important question is whether the selected change is self-contained. A patch may refer to functions, configuration, or tests introduced by earlier commits that are absent from the destination.

Inspect the source patch and the surrounding history. Confirm that the destination does not already contain an equivalent fix under another commit identifier. Repeatedly applying similar changes can produce conflicts or duplicated behavior. For merge commits, parent selection introduces additional semantics; do not use a simple single-commit recipe without understanding which parent defines the change you intend to replay.

## Apply to a verified destination

The placeholder COMMIT must be replaced with the inspected commit identifier. Start with a clean working state or preserve unrelated changes through an appropriate checkpoint. Create a recovery reference if the integration is significant. The command acts on the current branch, so checking that name is essential rather than cosmetic.

1. If Git stops for conflicts, inspect status, resolve the intended behavior, stage only resolved paths, and use git cherry-pick --continue.
2. If the selected change or destination was wrong, git cherry-pick --abort can cancel an active operation. Inspect and preserve any valuable conflict-resolution edits first.

````shell
git status --short --branch
git show --stat COMMIT
git show COMMIT
git cherry-pick COMMIT
git log -1 --oneline
````

## Verify the new commit in its new context

The replayed commit generally has a different identity because its parent and committer context differ. Compare its patch with the intended fix and run the destination branch’s relevant tests. A clean application only proves that Git could combine text; it does not prove compatibility with the older release or its dependencies.

For a public backport, the project may require recording the original commit identifier, often through the supported -x option. Follow that convention deliberately and explain any adaptations made for the destination. Do not rewrite the source branch simply because the change now exists elsewhere. Finish by checking status for leftover conflicts or unrelated edits, and review the exact branch you plan to publish. The result should be a clearly attributable fix on the intended line of history, with evidence that it works there.

A backport may need a different test because the destination branch has older dependencies. Explain that adaptation rather than claiming the source branch’s passing test proves compatibility.

## Sources and further reading

- [Git reference: git-cherry-pick](https://git-scm.com/docs/git-cherry-pick)
- [Git reference: git-show](https://git-scm.com/docs/git-show)

## Related guides

- [Git clone vs Download ZIP: choose the right copy](https://githtml.com/guides/git-clone-versus-download-zip)
- [Find where a Git configuration setting comes from](https://githtml.com/guides/git-config-find-setting-origin)
- [Set the correct Git author name and email](https://githtml.com/guides/git-configure-author-name-email)
- [Create and switch to a Git branch without losing edits](https://githtml.com/guides/git-create-and-switch-branch)

Editorial approach: https://githtml.com/guides/about
