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

Re: How do I show only log messages for commits on a specific branch?

From
Elijah Newren <newren@gmail.com>
Date
Dec 16, 2009, 23:59 UTC
Message-ID
<51419b2c0912161559x4de94464pe06df2845dbe3b78@mail.gmail.com>
In-Reply-To
<20091216232641.GK25474@genesis.frugalware.org>
On Wed, Dec 16, 2009 at 4:26 PM, Miklos Vajna <vmiklos@frugalware.org> wrote:
Show 6 quoted lines
> On Wed, Dec 16, 2009 at 11:05:52AM -0700, Elijah Newren <newren@gmail.com> wrote:
>>   git log new@{30.years.ago}..new
>> (You'll get a warning that 'new' hasn't existed for 30 years but it
>> doesn't hurt anything)
>
> That's the same as "git log new", if I'm not mistaken.

Did you try it with a 'new' branch in your repository that started at the beginning of history rather than at some commit? "git log new" and "git log new@{30.years.ago}..new" are not the same for me with git-1.6.5.5:

$ git init repo
$ cd repo
$ echo content> foo && git add foo && git commit -mone foo
$ echo more content >> foo && git commit -mtwo foo
$ git checkout -b new master~1
$ echo stuff >> foo && git commit -mthree foo
$ git log new@{30.years.ago}..new
warning: Log for 'new' only goes back to Wed, 16 Dec 2009 16:48:02 -0700.
commit 7df8bad7cc146875c59ab030da0d25555976e79c
Author: Elijah Newren <newren@gmail.com>
Date:   Wed Dec 16 16:48:07 2009 -0700
    three
$ git log new
commit 7df8bad7cc146875c59ab030da0d25555976e79c
Author: Elijah Newren <newren@gmail.com>
Date:   Wed Dec 16 16:48:07 2009 -0700
    three
commit b86eadcdb152877ade44bebf4b8742884949f29f
Author: Elijah Newren <newren@gmail.com>
Date:   Wed Dec 16 16:47:31 2009 -0700
    one
> What Stefan wants to do is to let git log show the commits which are
> only in the "new" branch, but I don't think there is an out-of-the-box
> solution for that.

Are you sure? I'm more inclined to believe he'd like to see all the commits that have been added to the "new" branch since he created it (which may be the same as what you say, but not necessarily). Of course, neither my assumption or yours match what he actually asked for (though I think what he asked for isn't possible and is merely an means to the end he really wants).

Also, I think this does what you asked for (the commits in the "new"
branch but no other branch):
$ git log new $(git for-each-ref --format='%(refname)' 'refs/heads/*'
| grep -v '^refs/heads/new$' | sed -e s/^/^/)
Previous: Elijah NewrenNext: Miklos Vajna
Message 6 of 10 in “How do I show only log messages for commits on a specific branch?”
  1. bd@bc-bd.orgDec 16, 2009
  2. Elijah NewrenDec 16, 2009
  3. Miklos VajnaDec 16, 2009
  4. Santi BéjarDec 16, 2009
  5. Elijah NewrenDec 17, 2009
  6. Elijah NewrenDec 16, 2009
  7. Miklos VajnaDec 17, 2009
  8. Stefan VölkelDec 17, 2009
  9. David RodenDec 17, 2009
  10. Pat NotzDec 17, 2009

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.