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

Re: git log format documentation/manpage

From
René Scharfe <l.s.r@web.de>
Date
Oct 25, 2025, 17:00 UTC
Message-ID
<5c5c37b6-c3eb-45fc-901a-0f8e7f6d7d0e@web.de>
In-Reply-To
<KL1PR03MB5748DE5406618053D0A6CE0AEBF1A@KL1PR03MB5748.apcprd03.prod.outlook.com>
On 10/24/25 10:06 AM, David Moberg wrote:
Show 5 quoted lines
> Hi I'm trying to replicate the "oneline" log format and add notes to 
> it. What I can't figure out:
> 
> 1. What is the format string that corresponds to pretty format 
> "oneline"?

--oneline on terminal: %C(auto)%h%(decorate) %s --oneline otherwise: %C(auto)%h %s --format=oneline on terminal: %C(auto)%H%(decorate) %s --format=oneline otherwise: %C(auto)%H %s

The %(decorate) part also depends on the config setting log.decorate.
> 2. What is the placeholder for the title-line? By searching for 
> "title-line" in `man git log` I couldn't find anything. Surely this 
> is in here somewhere? Searching for `full-commit-message` also left 
> me empty-handed.

%s for subject, %b for body, %B for the whole commit message (subject and body). Email terms because Git was developed for Linux and commits were exchanged on a mailing list, like we do here for Git.

> 3. How can I display notes (%N from `git notes add`) as in-line 
> information (stripping away newlines at the end)?

I don't think that's currently possible. You might assume that %w (wrap) with a huge width would do it, but it doesn't.

Show 6 quoted lines
> How do I figure out the placeholders?
> 
> Suggestion for manpage improvements:
> 1. the pretty formats (oneline, short, ...) should come with a
> (t)format string that it corresponds to. They will act as great
> examples.
Good idea.

I would also prefer the named formats actually being implemented as these format strings instead of being hand-coded -- for clarity, simplicity and for proving that the placeholders are powerful enough.

> 2. Make sure the descriptions of the pretty formats ("<title-line>",
> "<full-commit-message>", ...) are searchable.

Expanding the current one-word descriptions, e.g., with synonyms, seems like a good idea. Care to send a doc patch?

René
Previous: Junio C Hamano
Message 4 of 4 in “git log format documentation/manpage”
  1. David MobergOct 24, 2025
  2. D. Ben KnobleOct 25, 2025
  3. Junio C HamanoOct 25, 2025
  4. René ScharfeOct 25, 2025

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.