git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Question about git-cherry and the rev list it's using

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
May 12, 2011, 06:47 UTC
Message-ID
<4DCB826F.5020406@drmicha.warpmail.net>
In-Reply-To
<BANLkTinMfVE=s+TouyxE-ucf7MHGf1m7HA@mail.gmail.com>
Francis Moreau venit, vidit, dixit 11.05.2011 18:11:
Show 7 quoted lines
> Hello,
> 
> I'm using "git cherry old master base" to see if all commits between
> master and base have been applied in my 'old' branch.
> 
> So I expect that git cherry is using a list of commits given by : "git
> rev-list --no-merges base..master".
Not really.

For each commit in "--no-merges old..master ^base" (i.e. "--no-merges master ^old ^base"), "git cherry" checks whether there is a patch equivalent commit in "--no-merges master..old", and outputs it with + or -.

Show 9 quoted lines
> But it looks like it's not the case:
> 
>   $ git rev-list --no-merges --oneline base..master | wc -l
>   22
> 
>   $ git cherry old master base | wc -l
>   12
> 
> Could anybody help me on this because I don't understand the results I have ?
"--no-merges ^old ^base" should rev-list --count to 12.
But you may be better off with something like
git rev-list --count --cherry master...old ^base
(untested)
Michael
Previous: Francis MoreauNext: Francis Moreau
Message 2 of 6 in “Question about git-cherry and the rev list it's using”
  1. Francis MoreauMay 11, 2011
  2. Michael J GruberMay 12, 2011
  3. Francis MoreauMay 13, 2011
  4. Francis MoreauMay 13, 2011
  5. Michael J GruberMay 13, 2011
  6. Francis MoreauMay 13, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.