Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

github

csv

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.

like image 869
Justin Jackson Avatar asked May 02 '12 16:05

Justin Jackson


People also ask

How get commit history?

`git log` command is used to view the commit history and display the necessary information of the git repository. This command displays the latest git commits information in chronological order, and the last commit will be displayed first.

Which command is used to show commit logs in git?

The git log command displays all of the commits in a repository's history.

Which command used to list the commit history?

The git log command enables you to display a list of all of the commits on your current branch.


1 Answers

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.

like image 80
Simon Avatar answered Sep 28 '22 08:09

Simon