The most straight-forward way to output stats (through --shortstat) is cumbersome as it gets printed on a new line. As some commits don't have any stats, the new line pattern breaks, making it difficult to port the data reliably. To compensate for that, I had to use several bash commands besides the git log (sed, tr, paste), as you also realised was necessary to use awk...
My solution involves two scripts and is a bit too lengthy to post here, so I'm posting a link instead:
That was a good take!
The most straight-forward way to output stats (through
--shortstat
) is cumbersome as it gets printed on a new line. As some commits don't have any stats, the new line pattern breaks, making it difficult to port the data reliably. To compensate for that, I had to use severalbash
commands besides thegit log
(sed
,tr
,paste
), as you also realised was necessary to useawk
...My solution involves two scripts and is a bit too lengthy to post here, so I'm posting a link instead:
https://github.com/dreamyguy/gitlogg
Some of Gitlogg's features are:
git log
of multiple repositories into oneJSON
file.repository
key/value.files changed
,insertions
anddeletions
keys/values.impact
key/value, which represents the cumulative changes for the commit (insertions
-deletions
)."
by converting them to single quotes'
on all values that allow or are created by user input, likesubject
.pretty=format:
placeholders are available.JSON
by commenting out/uncommenting the available ones.