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