Re: Cherry-pick picks more commits (and miss some) than provided

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 29, 2020 at 10:00 AM Eugen Konkov <kes-kes@xxxxxxxxx> wrote:
>
> Hello Git,
>
> $ git --version
> git version 2.28.0
>
>
> If I do
> git cherry-pick 90a075bf f2c161b7^..ae27237e fb7e608e f34c9562 76f2568a fb141148
>
> then more commits are copied and some commits are ignored

This says to pick all the commits in the history of 90a075bf or
ae27237e or fb7e608e or f34c9562 or 76f2568a or fb141148 that are not
in the history of f2c161b7^.  In other words, it'll cherry-pick all
the commits that show up in the output of either
  git rev-list 90a075bf f2c161b7^..ae27237e fb7e608e f34c9562 76f2568a fb141148
or, equivalently, the output of
  git rev-list 90a075bf ae27237e fb7e608e f34c9562 76f2568a fb141148
--not f2c161b7^

> But when I do step by step then every thing is OK
>
> git cherry-pick 90a075bf
> git cherry-pick f2c161b7^..ae27237e
> git cherry-pick fb7e608e f34c9562 76f2568a fb141148

This is very different.  This says to pick all the commits in the
history of ae27237e that are not in the history of f2c161b7^, plus
grab commits 90a075bf, fb7e608e, f34c9562, 76f2568a, and fb141148.

The only cases when the two would mean the same thing are when all of
90a075bf, fb7e608e, f34c9562, 76f2568a, and fb141148 have f2c161b7^ as
their parent.

This comes from this part of the manual:
       <commit>...
           Commits to cherry-pick. For a more complete list of ways to
spell commits, see gitrevisions(7). Sets of
           commits can be passed but no traversal is done by default,
as if the --no-walk option was specified, see
           git-rev-list(1). Note that specifying a range will feed all
<commit>... arguments to a single revision
           walk (see a later example that uses maint master..next).

The fact that you specified a range (f2c161b7^..ae27237e) among your
arguments, meant that the implicit --no-walk was omitted and now all
arguments became ranges.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux