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