Documentation / git-cherry-pick.txton commit Merge branch 'ml/rebase-x-strategy' (06d11b2)
   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
  12DESCRIPTION
  13-----------
  14
  15Given one or more existing commits, apply the change each one
  16introduces, recording a new commit for each.  This requires your
  17working tree to be clean (no modifications from the HEAD commit).
  18
  19OPTIONS
  20-------
  21<commit>...::
  22        Commits to cherry-pick.
  23        For a more complete list of ways to spell commits, see
  24        linkgit:gitrevisions[1].
  25        Sets of commits can be passed but no traversal is done by
  26        default, as if the '--no-walk' option was specified, see
  27        linkgit:git-rev-list[1].
  28
  29-e::
  30--edit::
  31        With this option, 'git cherry-pick' will let you edit the commit
  32        message prior to committing.
  33
  34-x::
  35        When recording the commit, append to the original commit
  36        message a note that indicates which commit this change
  37        was cherry-picked from.  Append the note only for cherry
  38        picks without conflicts.  Do not use this option if
  39        you are cherry-picking from your private branch because
  40        the information is useless to the recipient.  If on the
  41        other hand you are cherry-picking between two publicly
  42        visible branches (e.g. backporting a fix to a
  43        maintenance branch for an older release from a
  44        development branch), adding this information can be
  45        useful.
  46
  47-r::
  48        It used to be that the command defaulted to do `-x`
  49        described above, and `-r` was to disable it.  Now the
  50        default is not to do `-x` so this option is a no-op.
  51
  52-m parent-number::
  53--mainline parent-number::
  54        Usually you cannot cherry-pick a merge because you do not know which
  55        side of the merge should be considered the mainline.  This
  56        option specifies the parent number (starting from 1) of
  57        the mainline and allows cherry-pick to replay the change
  58        relative to the specified parent.
  59
  60-n::
  61--no-commit::
  62        Usually the command automatically creates a sequence of commits.
  63        This flag applies the changes necessary to cherry-pick
  64        each named commit to your working tree and the index,
  65        without making any commit.  In addition, when this
  66        option is used, your index does not have to match the
  67        HEAD commit.  The cherry-pick is done against the
  68        beginning state of your index.
  69+
  70This is useful when cherry-picking more than one commits'
  71effect to your index in a row.
  72
  73-s::
  74--signoff::
  75        Add Signed-off-by line at the end of the commit message.
  76
  77--ff::
  78        If the current HEAD is the same as the parent of the
  79        cherry-pick'ed commit, then a fast forward to this commit will
  80        be performed.
  81
  82EXAMPLES
  83--------
  84git cherry-pick master::
  85
  86        Apply the change introduced by the commit at the tip of the
  87        master branch and create a new commit with this change.
  88
  89git cherry-pick ..master::
  90git cherry-pick ^HEAD master::
  91
  92        Apply the changes introduced by all commits that are ancestors
  93        of master but not of HEAD to produce new commits.
  94
  95git cherry-pick master\~4 master~2::
  96
  97        Apply the changes introduced by the fifth and third last
  98        commits pointed to by master and create 2 new commits with
  99        these changes.
 100
 101git cherry-pick -n master~1 next::
 102
 103        Apply to the working tree and the index the changes introduced
 104        by the second last commit pointed to by master and by the last
 105        commit pointed to by next, but do not create any commit with
 106        these changes.
 107
 108git cherry-pick --ff ..next::
 109
 110        If history is linear and HEAD is an ancestor of next, update
 111        the working tree and advance the HEAD pointer to match next.
 112        Otherwise, apply the changes introduced by those commits that
 113        are in next but not HEAD to the current branch, creating a new
 114        commit for each new change.
 115
 116git rev-list --reverse master \-- README | git cherry-pick -n --stdin::
 117
 118        Apply the changes introduced by all commits on the master
 119        branch that touched README to the working tree and index,
 120        so the result can be inspected and made into a single new
 121        commit if suitable.
 122
 123Author
 124------
 125Written by Junio C Hamano <gitster@pobox.com>
 126
 127Documentation
 128--------------
 129Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
 130
 131SEE ALSO
 132--------
 133linkgit:git-revert[1]
 134
 135GIT
 136---
 137Part of the linkgit:git[1] suite