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

Re: help with git query

From
Björn Steinbrink <b.steinbrink@gmx.de>
Date
Apr 14, 2009, 06:26 UTC
Message-ID
<20090414062652.GC3948@atjola.homenet>
In-Reply-To
<20090414054654.GC19027@coredump.intra.peff.net>
On 2009.04.14 01:46:54 -0400, Jeff King wrote:
Show 20 quoted lines
> On Mon, Apr 13, 2009 at 03:31:49PM -0500, Nathan W. Panike wrote:
> 
> > > for each branch:
> > >  - info about the latest commit on that branch (date and time, message, etc.)
> > 
> > Depending on what you want to do---from a bash shell, you could do:
> > 
> > for i in $(git branch -a | cut -b3-); do echo $i; git show -s $i; echo; done
> 
> Ick, please use the plumbing designed for this exact thing instead of
> trying to parse "git branch":
> 
>   $ git for-each-ref --format='%(subject)
>     %(authorname) %(authoremail)
>     %(authordate)' refs/heads/
> 
> or however you want to format it. See "git help for-each-ref" for a list
> of fields (you can also just pipe the output of for-each-ref into a
> shell loop, as in your example, but with the format options there is
> often no need).
git log --no-walk --branches --decorate --pretty=short

is what I use, sometimes. Some other "pretty" format might be more suitable for your use case.

Björn
Previous: Jeff King
Message 6 of 6 in “help with git query”
  1. E RApr 13, 2009
  2. Nathan W. PanikeApr 13, 2009
  3. E RApr 13, 2009
  4. Nathan W. PanikeApr 13, 2009
  5. Jeff KingApr 14, 2009
  6. Björn SteinbrinkApr 14, 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.