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. -e:: --edit:: @@ -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. + `git cherry-pick master~4 master~2`:: Apply the changes introduced by the fifth and third last -- 1.7.10.2.520.g6a4a482 -- 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