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

徘徊边缘 提交于 2020-11-30 02:12:25

问题


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.


回答1:


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.




回答2:


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



回答3:


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


来源:https://stackoverflow.com/questions/10418056/how-do-i-generate-a-git-commit-log-for-the-last-month-and-export-it-as-csv

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!