Skip to contentSkip to conversation

something like git-for-each-ref's --format for commits?

DISCUSSION Brian Swetland 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

I'm trying to obtain various information about commits from a script. The --format option to git-for-each-ref would be perfect, except that it only operates on refs, not arbitrary commit objects.

The --pretty=format:... option for git-log, etc has the annoying property of giving you <unknown> instead of an empty string if an item isn't example (say if you use %b on a commit with no body).

Am I missing some obvious solution here?

Thanks,

Brian

#1 lore raw
Quoted 5 lines · Brian Swetland

The --pretty=format:... option for git-log, etc has the annoying property of giving you <unknown> instead of an empty string if an item isn't example (say if you use %b on a commit with no body).

Am I missing some obvious solution here?

I think --pretty=format: is what you are looking for. The "<unknown>" behavior is fixed in the upcoming v1.5.4 (you get the empty string for your example).

-Peff