How do I generate a git commit log for the last month, and export it as CSV?

You can use the --since and --pretty option of git log, for instance:

git log --since="last month" --pretty=format:'%h,%an,%ar,%s' > log.csv

Refer to the PRETTY FORMATS section of the Git log man page for more options.


To add, if you want to apply date range, add --after or --before in this format "yyyy-mM-d"

git log --before="2016-12-1" --pretty=format:'"%h","%an","%ae","%aD","%s",' --shortstat --no-merges | paste - - - > log.csv

This command creates a formatted CSV containing hash,user,date/time,description,files changed,insertions,deletions

git log --pretty=format:'"%h","%an","%aD","%s",' --shortstat --no-merges | paste - - - > log.csv

Tags:

Csv

Git

Github