git cherry-pick Copy individual commits onto the current branch
Takes the change from one or more existing commits and applies it as new commits where you are now. Useful for backporting a fix without merging the whole branch.
Synopsis
git cherry-pick [OPTION]... COMMIT...
git cherry-pick --continue | --abort
Common options
| Option or form | What it does |
|---|---|
-n, --no-commit | Apply the change but do not commit it |
-x | Add "(cherry picked from ...)" to the message |
-m N | Pick a merge commit, using parent N as the mainline |
A..B | Pick a range of commits after A up to and including B |
--abort | Cancel after a conflict |
Examples
git cherry-pick 3f2a9c1
[release 9a8b7c6] Fix null crash
1 file changed, 2 insertions(+)
git cherry-pick 3f2a9c1 8b1d7e4
git cherry-pick 3f2a9c1^..8b1d7e4
git cherry-pick -n 3f2a9c1
Notes
- The copy has a new hash, so the same change can show up twice if you later merge both branches. Git usually copes.
- Conflicts are fixed the same way as in a merge: edit, git add, then git cherry-pick --continue.
- Find the commit hash first with git log on the source branch.
See also
Last reviewed 2026-10-09.