Re: Cherry-pick picks more commits (and miss some) than provided
- From
Elijah Newren <newren@gmail.com>
- Date
- Jul 29, 2020, 18:09 UTC
- Message-ID
- <CABPp-BF4C1ixfYn=Bavg+kbnB0M=KJv=yuh_nxymwX-woGhh5A@mail.gmail.com>
- In-Reply-To
- <186376813.20200729195318@yandex.ru>
On Wed, Jul 29, 2020 at 10:00 AM Eugen Konkov <kes-kes@yandex.ru> wrote:
Show 11 quoted lines
> > 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^
Show 5 quoted lines
> 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.