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

Feature Request: Document the log format string equivalent of built-in formats

From
HQHenry Qin <root@hq6.me>
Date
Oct 15, 2024, 17:31 UTC
Message-ID
<CAO8bsPCWkqDFSqWwJ3gQt7O2g1okodb_Q-NbbkTq9bc7M=zU1A@mail.gmail.com>
Hi folks,

I think it is useful to be able to take any of the pre-existing formats offered by `git log --format=<format>` and tweak it a little bit.

In order to do this efficiently, it's helpful to have the format string equivalent of each pretty format documented explicitly, together with any limitations in being able to replicate them using a format string..

The documentation in `man git-log` under PRETTY FORMATS is helpful but insufficient.

For example, I tried to reproduce the format `medium` and have the following:

git log --format='%C(auto)commit %H%d%nAuthor: %an <%ae>%nDate: %ad%n%n%w(0,4,4)%s%n%n%-b%-C()%n'

There are two differences I have observed, and I have not yet been able to determine whether it's even possible to correct them.

1. In my output, the ref names output by %d are added unconditionally,
while git log will suppress them when the output is a file, and shows
them when the output is a terminal.
2. In my output, I sometimes see a raw ^M symbol in commit messages,
but git log output does not show raw CR characters in its output even
when CRLF is in the commit message.

Thanks, ~Henry

Next: Kristoffer Haugsbakk
Message 1 of 3 in “Feature Request: Document the log format string equivalent of built-in formats”
  1. Henry QinOct 15, 2024
  2. Kristoffer HaugsbakkOct 15, 2024
  3. Henry QinOct 15, 2024

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.