Carlos Martín Nieto <cmn@xxxxxxxx> writes: > 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 cause the user to think that > > git cherry-pick A B..C > > will apply A and then B..C. This is not what happens. Instead the revs > are given to rev-list which will consider A and C as positive revs and > B as a negative one. 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@xxxxxxxx> > --- > Documentation/git-cherry-pick.txt | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/Documentation/git-cherry-pick.txt b/Documentation/git-cherry-pick.txt > index 06a0bfd..10abfbf 100644 > --- a/Documentation/git-cherry-pick.txt > +++ b/Documentation/git-cherry-pick.txt > @@ -48,6 +48,7 @@ OPTIONS > Sets of commits can be passed but no traversal is done by > default, as if the '--no-walk' option was specified, see > linkgit:git-rev-list[1]. > + Note that specifying a range will activate revision walking. That is not wrong per-se, but I do not think it would have helped Yann. How about phrasing it this way? Note that specifying a range will feed all <commit>... arguments to a single revision walk (see a later example that uses 'maint master..next'). > @@ -130,6 +131,15 @@ EXAMPLES > Apply the changes introduced by all commits that are ancestors > of master but not of HEAD to produce new commits. > > +`git cherry-pick master next ^maint`:: > +`git cherry-pick master maint..next`:: > + > + Apply the changes introduced by all commits that are ancestors > + of master or next, but not maint or any of its ancestors. The > + second spelling is often a misunderstanding of revision > + walking works when trying to apply a range plus a particular > + commit and included for completeness. If you are using these three branches because you expect familiarity with the convention of maint < master < next on the reader's side, I think it should be rewritten like this. `git cherry-pick maint next ^master`:: `git cherry-pick maint master..next`:: Apply the changes introduced by all commits that are ancestors of maint or next, but not master or any of its ancestors. Note that the latter does not mean `maint` and everything between `master` and `next`; specifically, `maint` will not be used if it is included in `master`. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html