Re: help with git query
- From
Jeff King <peff@peff.net>
- Date
- Apr 14, 2009, 05:46 UTC
- Message-ID
- <20090414054654.GC19027@coredump.intra.peff.net>
- In-Reply-To
- <d77df1110904131331p24f52220o74c401c97fbb904d@mail.gmail.com>
On Mon, Apr 13, 2009 at 03:31:49PM -0500, Nathan W. Panike wrote:
Show 6 quoted lines
> > 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).
-Peff