Documentation / git-cherry-pick.txton commit revert: Introduce --continue to continue the operation (5a5d80f)
   1git-cherry-pick(1)
   2==================
   3
   4NAME
   5----
   6git-cherry-pick - Apply the changes introduced by some existing commits
   7
   8SYNOPSIS
   9--------
  10'git cherry-pick' [--edit] [-n] [-m parent-number] [-s] [-x] [--ff] <commit>...
  11'git cherry-pick' --reset
  12'git cherry-pick' --continue
  13
  14DESCRIPTION
  15-----------
  16
  17Given one or more existing commits, apply the change each one
  18introduces, recording a new commit for each.  This requires your
  19working tree to be clean (no modifications from the HEAD commit).
  20
  21When it is not obvious how to apply a change, the following
  22happens:
  23
  241. The current branch and `HEAD` pointer stay at the last commit
  25   successfully made.
  262. The `CHERRY_PICK_HEAD` ref is set to point at the commit that
  27   introduced the change that is difficult to apply.
  283. Paths in which the change applied cleanly are updated both
  29   in the index file and in your working tree.
  304. For conflicting paths, the index file records up to three
  31   versions, as described in the "TRUE MERGE" section of
  32   linkgit:git-merge[1].  The working tree files will include
  33   a description of the conflict bracketed by the usual
  34   conflict markers `<<<<<<<` and `>>>>>>>`.
  355. No other modifications are made.
  36
  37See linkgit:git-merge[1] for some hints on resolving such
  38conflicts.
  39
  40OPTIONS
  41-------
  42<commit>...::
  43        Commits to cherry-pick.
  44        For a more complete list of ways to spell commits, see
  45        linkgit:gitrevisions[7].
  46        Sets of commits can be passed but no traversal is done by
  47        default, as if the '--no-walk' option was specified, see
  48        linkgit:git-rev-list[1].
  49
  50-e::
  51--edit::
  52        With this option, 'git cherry-pick' will let you edit the commit
  53        message prior to committing.
  54
  55-x::
  56        When recording the commit, append a line that says
  57        "(cherry picked from commit ...)" to the original commit
  58        message in order to indicate which commit this change was
  59        cherry-picked from.  This is done only for cherry
  60        picks without conflicts.  Do not use this option if
  61        you are cherry-picking from your private branch because
  62        the information is useless to the recipient.  If on the
  63        other hand you are cherry-picking between two publicly
  64        visible branches (e.g. backporting a fix to a
  65        maintenance branch for an older release from a
  66        development branch), adding this information can be
  67        useful.
  68
  69-r::
  70        It used to be that the command defaulted to do `-x`
  71        described above, and `-r` was to disable it.  Now the
  72        default is not to do `-x` so this option is a no-op.
  73
  74-m parent-number::
  75--mainline parent-number::
  76        Usually you cannot cherry-pick a merge because you do not know which
  77        side of the merge should be considered the mainline.  This
  78        option specifies the parent number (starting from 1) of
  79        the mainline and allows cherry-pick to replay the change
  80        relative to the specified parent.
  81
  82-n::
  83--no-commit::
  84        Usually the command automatically creates a sequence of commits.
  85        This flag applies the changes necessary to cherry-pick
  86        each named commit to your working tree and the index,
  87        without making any commit.  In addition, when this
  88        option is used, your index does not have to match the
  89        HEAD commit.  The cherry-pick is done against the
  90        beginning state of your index.
  91+
  92This is useful when cherry-picking more than one commits'
  93effect to your index in a row.
  94
  95-s::
  96--signoff::
  97        Add Signed-off-by line at the end of the commit message.
  98
  99--ff::
 100        If the current HEAD is the same as the parent of the
 101        cherry-pick'ed commit, then a fast forward to this commit will
 102        be performed.
 103
 104--strategy=<strategy>::
 105        Use the given merge strategy.  Should only be used once.
 106        See the MERGE STRATEGIES section in linkgit:git-merge[1]
 107        for details.
 108
 109-X<option>::
 110--strategy-option=<option>::
 111        Pass the merge strategy-specific option through to the
 112        merge strategy.  See linkgit:git-merge[1] for details.
 113
 114SEQUENCER SUBCOMMANDS
 115---------------------
 116include::sequencer.txt[]
 117
 118EXAMPLES
 119--------
 120git cherry-pick master::
 121
 122        Apply the change introduced by the commit at the tip of the
 123        master branch and create a new commit with this change.
 124
 125git cherry-pick ..master::
 126git cherry-pick ^HEAD master::
 127
 128        Apply the changes introduced by all commits that are ancestors
 129        of master but not of HEAD to produce new commits.
 130
 131git cherry-pick master{tilde}4 master{tilde}2::
 132
 133        Apply the changes introduced by the fifth and third last
 134        commits pointed to by master and create 2 new commits with
 135        these changes.
 136
 137git cherry-pick -n master~1 next::
 138
 139        Apply to the working tree and the index the changes introduced
 140        by the second last commit pointed to by master and by the last
 141        commit pointed to by next, but do not create any commit with
 142        these changes.
 143
 144git cherry-pick --ff ..next::
 145
 146        If history is linear and HEAD is an ancestor of next, update
 147        the working tree and advance the HEAD pointer to match next.
 148        Otherwise, apply the changes introduced by those commits that
 149        are in next but not HEAD to the current branch, creating a new
 150        commit for each new change.
 151
 152git rev-list --reverse master \-- README | git cherry-pick -n --stdin::
 153
 154        Apply the changes introduced by all commits on the master
 155        branch that touched README to the working tree and index,
 156        so the result can be inspected and made into a single new
 157        commit if suitable.
 158
 159The following sequence attempts to backport a patch, bails out because
 160the code the patch applies to has changed too much, and then tries
 161again, this time exercising more care about matching up context lines.
 162
 163------------
 164$ git cherry-pick topic^             <1>
 165$ git diff                           <2>
 166$ git reset --merge ORIG_HEAD        <3>
 167$ git cherry-pick -Xpatience topic^  <4>
 168------------
 169<1> apply the change that would be shown by `git show topic^`.
 170In this example, the patch does not apply cleanly, so
 171information about the conflict is written to the index and
 172working tree and no new commit results.
 173<2> summarize changes to be reconciled
 174<3> cancel the cherry-pick.  In other words, return to the
 175pre-cherry-pick state, preserving any local modifications you had in
 176the working tree.
 177<4> try to apply the change introduced by `topic^` again,
 178spending extra time to avoid mistakes based on incorrectly matching
 179context lines.
 180
 181SEE ALSO
 182--------
 183linkgit:git-revert[1]
 184
 185GIT
 186---
 187Part of the linkgit:git[1] suite