Re: git log format documentation/manpage
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 25, 2025, 16:35 UTC
- Message-ID
- <xmqq4irnndm3.fsf@gitster.g>
- In-Reply-To
- <CALnO6CBLUGgBMeRf0uLA=TKVaMQvap9Wpa4uTAGQD5he40xeWw@mail.gmail.com>
"D. Ben Knoble" <ben.knoble@gmail.com> writes:
Show 5 quoted lines
> I don't have the answer to everything, but for your goal, does > `--oneline --notes` not give you something close enough? > > Since notes can be arbitrary text, making them "inline" with the > oneline format seems like an uphill battle to me.
A commit log message is an arbitrary piece of text, so we gave the distinction of %s (subject) vs %b (body) to allow us to say "%h %s" to show only the commit subject.
There is nothing similar for notes, so in that sense, you are correct to point out that only with %N, it would not be possible to come up with universally good formatting, unless you somehow control what you write in your notes (e.g. limit yourself to oneliners).
If the rumored unification of format languages between "git log" family of commands and "git for-each-ref" family of commands ever comes, then we might be able to borrow conditional formatting and text manipulation primitives the latter may have in order to do things like "show the first line of note string, inside a pair of parentheses, but only do so when note does exist and not empty".
But until the unification of format languages happens (which as far as I understand nobody is working on right now, even though I vaguely recall it was a topic in vogue for mentoring programs some years ago), I do not think it is feasible.