git-cherry-pick.txt: clarify the use of revision range notation
When given a set of commits, cherry-pick will apply the changes for all of them. Specifying a simple range will also work as expected. This can lead the user to think that git cherry-pick A B..C may apply A and then B..C, but that is not what happens. Instead the revs are given to a single invocation of rev-list, which will consider A and C as positive revs and B as a negative one. The commit A will not be used if it is an ancestor of B. Add a note about this and add an example with this particular syntax, which has shown up on the list a few times. Signed-off-by: Carlos Martín Nieto <cmn@elego.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Carlos Martín Nieto committed
Jun 15, 2012 at 16:33 UTC
b98878edefd284927748aa2ce9ff090fa43c2c8a
1 file changed
+12
-1
Documentation/git-cherry-pick.txt
+12
-1
@@ -47,7 +47,9 @@ OPTIONS
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].
50
+ linkgit:git-rev-list[1]. Note that specifying a range will
51
+ feed all <commit>... arguments to a single revision walk
52
+ (see a later example that uses 'maint master..next').
53
54
-e::
55
--edit::
@@ -130,6 +132,15 @@ EXAMPLES
132
Apply the changes introduced by all commits that are ancestors
133
of master but not of HEAD to produce new commits.
134
135
+`git cherry-pick maint next ^master`::
136
+`git cherry-pick maint master..next`::
137
+
138
+ Apply the changes introduced by all commits that are
139
+ ancestors of maint or next, but not master or any of its
140
+ ancestors. Note that the latter does not mean `maint` and
141
+ everything between `master` and `next`; specifically,
142
+ `maint` will not be used if it is included in `master`.
143
+
144
`git cherry-pick master{tilde}4 master{tilde}2`::
145
146
Apply the changes introduced by the fifth and third last