threads / discuss / 61879

Feature request: Stats in git log

Subject: Feature request: Stats in git log

## tl;dr

One message between Aug 1, 2024 and Aug 1, 2024.

replies: 0people: 1as markdown or json

Steinar Sturlaugsson· Aug 1, 2024, 14:25 UTC · lore
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

← back to recent threads