# git log format documentation/manpage

4 messages from 2025-10-24 to 2025-10-25. Participants: David Moberg, D. Ben Knoble, Junio C Hamano, René Scharfe.
Thread: https://gitlist.dev/t/64376

## David Moberg, 2025-10-24 08:06

Subject: git log format documentation/manpage
Message-ID: <KL1PR03MB5748DE5406618053D0A6CE0AEBF1A@KL1PR03MB5748.apcprd03.prod.outlook.com>
URL: https://gitlist.dev/e/KL1PR03MB5748DE5406618053D0A6CE0AEBF1A%40KL1PR03MB5748.apcprd03.prod.outlook.com

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

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

Kind Regards,
David, kaddkaka, Moberg
```

## D. Ben Knoble, 2025-10-25 13:42

Subject: Re: git log format documentation/manpage
Message-ID: <CALnO6CBLUGgBMeRf0uLA=TKVaMQvap9Wpa4uTAGQD5he40xeWw@mail.gmail.com>
URL: https://gitlist.dev/e/CALnO6CBLUGgBMeRf0uLA%3DTKVaMQvap9Wpa4uTAGQD5he40xeWw%40mail.gmail.com
In-Reply-To: <KL1PR03MB5748DE5406618053D0A6CE0AEBF1A@KL1PR03MB5748.apcprd03.prod.outlook.com>

```
On Fri, Oct 24, 2025 at 4:07 AM David Moberg <David.Moberg@mediatek.com> wrote:
>
> 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"?
> 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.
> 3. How can I display notes (%N from `git notes add`) as in-line information (stripping away newlines at the end)?
>
> 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.
> 2. Make sure the descriptions of the pretty formats ("<title-line>", "<full-commit-message>", ...) are searchable.
>
> Kind Regards,
> David, kaddkaka, Moberg

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.

-- 
D. Ben Knoble

```

## Junio C Hamano, 2025-10-25 16:35

Subject: Re: git log format documentation/manpage
Message-ID: <xmqq4irnndm3.fsf@gitster.g>
URL: https://gitlist.dev/e/xmqq4irnndm3.fsf%40gitster.g
In-Reply-To: <CALnO6CBLUGgBMeRf0uLA=TKVaMQvap9Wpa4uTAGQD5he40xeWw@mail.gmail.com>

```
"D. Ben Knoble" <ben.knoble@gmail.com> writes:

> 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.

```

## René Scharfe, 2025-10-25 17:00

Subject: Re: git log format documentation/manpage
Message-ID: <5c5c37b6-c3eb-45fc-901a-0f8e7f6d7d0e@web.de>
URL: https://gitlist.dev/e/5c5c37b6-c3eb-45fc-901a-0f8e7f6d7d0e%40web.de
In-Reply-To: <KL1PR03MB5748DE5406618053D0A6CE0AEBF1A@KL1PR03MB5748.apcprd03.prod.outlook.com>

```
On 10/24/25 10:06 AM, David Moberg wrote:
> 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.

> 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é


```
