Feature request: Stats in git log

From: Steinar Sturlaugsson <hidden>
Date: 2024-08-01 14:26:05

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help