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

Feature request: Stats in git log

From
SSSteinar Sturlaugsson <costeinar@gmail.com>
Date
Aug 1, 2024, 14:25 UTC
Message-ID
<CAAWdfG6yprY_uFOQq5wK20EgwNrUcnmVpnBz3ejfBXcs-i_aZg@mail.gmail.com>
Hi,
Long time lurker sending my first mail to the list. I hope I'm doing this right.

I'm interested in getting the stats that are shown with `git log --shortstat` based on the format string provided with the `--pretty` flag.

Example:

``` git log --oneline --pretty=format:%ad,%H --date=iso --shortstat ```

This returns something like:
```
2021-01-07 09:56:48 +0100,<SHA>
 58 files changed, 21 insertions(+), 50 deletions(-)
```

I will now have to parse the input for my purposes of reporting it in a CSV file.

I wonder if (A) it's possible to specify this already with e.g.

``` git log --oneline --pretty=format:%ad,%H,<changedflag>,<insertedflag>,<deletedflag> --date=iso ```

where the result for the same commit would become:

``` 2021-01-07 09:56:48 +0100,<SHA>,58,21,50 ```

I'm aware that commits sometimes don't have stats. In that case, I would expect e.g. `NaN` or `null` instead of a number.

(B) If this is not available, is there any interest in a PR providing it?

Best, Steinar

Message 1 of 1 in “Feature request: Stats in git log”
  1. Steinar SturlaugssonAug 1, 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.