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

Re: Question about "git log --cherry"

From
John Keeping <john@keeping.me.uk>
Date
Sep 26, 2013, 20:21 UTC
Message-ID
<20130926202153.GC27238@serenity.lan>
In-Reply-To
<CAC9WiBjLqdqSKgLv_M6FPx3a2J-+ZKAQnk9OGn3h5SfqSpiT3g@mail.gmail.com>
On Thu, Sep 26, 2013 at 06:35:57PM +0200, Francis Moreau wrote:
Show 18 quoted lines
> I'm trying to use "git log --cherry ..." in order to display new, kept
> and removed commits between two branches A and B.
> 
> So commits which are only in B are considered new and should be marked
> with '+'. Commits which are in both branches are marked with '=' but
> only commit in branch B are shown. Eventually commits which are in A
> but not in B anymore should be marked with '-'.
> 
> So far I found this solution:
> 
>   $ git log --cherry-mark --right-only A...B
>   $ git log --cherry-pick  --left-only   A...B
> 
> but I have to call twice git-log. This can be annoying since depending
> on A and B, calling git-log can take time.
> 
> Is there another option that I'm missing which would do the job but
> with only one call to git-log ?
Does this do what you want?
    git log --cherry-mark --left-right A...B |
    sed -e '/^commit / {
        y/<>/-+/
    }'
Previous: Francis MoreauNext: Francis Moreau
Message 2 of 7 in “Question about "git log --cherry"”
  1. Francis MoreauSep 26, 2013
  2. John KeepingSep 26, 2013
  3. Francis MoreauSep 27, 2013
  4. John KeepingSep 27, 2013
  5. Francis MoreauSep 27, 2013
  6. John KeepingSep 27, 2013
  7. Francis MoreauSep 27, 2013

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.