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

GitCsvGithub

Git Problem Overview


Is there a way to generate a git commit log for the last month, and export it as a CSV file? I'm looking for something I can run from the command line, or a 3rd party app. I'd like the following columns: author, date of commit, subject, file edited and hash.

Git Solutions


Solution 1 - Git

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.

Solution 2 - Git

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

Solution 3 - Git

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJustin JacksonView Question on Stackoverflow
Solution 1 - GitSimonView Answer on Stackoverflow
Solution 2 - GitA.BadgerView Answer on Stackoverflow
Solution 3 - GitMarvin Glenn LacunaView Answer on Stackoverflow