NAME
git-cherry-pick - Apply the changes introduced by some existing commits
SYNOPSIS
git cherry-pick\n [--edit] [-n] [-m <parent-number>] [-s] [-x] [--ff]
\n
[-S[<keyid>]] <commit>...
\ngit cherry-pick\n (--continue | --skip | --abort | --quit)DESCRIPTION
Given one or more existing commits, apply the change each one introduces, recording a new commit for each. This requires your working tree to be clean (no modifications from the HEAD commit).
When it is not obvious how to apply a change, the following happens:
See git-merge(1) for some hints on resolving such conflicts.
OPTIONS
<commit>...
-e, --edit
--cleanup=<mode>
-x
-r
-m <parent-number>, --mainline <parent-number>
-n, --no-commit
This is useful when cherry-picking more than one commits' effect to your index in a row.
-s, --signoff
-S[<keyid>], --gpg-sign[=<keyid>], --no-gpg-sign
--ff
--allow-empty
--allow-empty-message
--empty=(drop|keep|stop)
drop
keep
stop
Note that --empty=drop and --empty=stop only specify how to handle a commit that was not initially empty, but rather became empty due to a previous commit. Commits that were initially empty will still cause the cherry-pick to fail unless one of --empty=keep or --allow-empty are specified.
--keep-redundant-commits
--strategy=<strategy>
-X<option>, --strategy-option=<option>
--rerere-autoupdate, --no-rerere-autoupdate
SEQUENCER SUBCOMMANDS
--continue
--skip
--quit
--abort
EXAMPLES
git cherry-pick master
git cherry-pick ..master, git cherry-pick ^HEAD master
git cherry-pick maint next ^master, git cherry-pick maint master..next
git cherry-pick master~4 master~2
git cherry-pick -n master~1 next
git cherry-pick --ff ..next
git rev-list --reverse master -- README | git cherry-pick -n --stdin
The following sequence attempts to backport a patch, bails out because the code the patch applies to has changed too much, and then tries again, this time exercising more care about matching up context lines.
$ git cherry-pick topic^ \n(1)\n
$ git diff \n(2)\n
$ git cherry-pick --abort \n(3)\n
$ git cherry-pick -Xpatience topic^ \n(4)| 1. | apply the change that would be shown by git show topic^ . In this example, the patch does not apply cleanly, so information about the conflict is written to the index and working tree and no new commit results. |
| 2. | summarize changes to be reconciled |
| 3. | cancel the cherry-pick. In other words, return to the pre-cherry-pick state, preserving any local modifications you had in the working tree. |
| 4. | try to apply the change introduced by topic^ again, spending extra time to avoid mistakes based on incorrectly matching context lines. |
SEE ALSO
git-revert(1)
GIT
Part of the git(1) suite