如何列出Git仓库中的贡献者及其活跃日期?

4

我想获取某个Git仓库的所有贡献者列表。对于每个贡献者,我还想打印出他们最早和最晚提交的时间戳。有没有一种使用git命令行提取这些信息的方法?


这可能有助于解决一部分难题... https://gehrcke.de/2015/06/git-list-authors-sorted-by-the-time-of-their-first-contribution/ - undefined
2个回答

4
这将为您提供所需的列表,包括作者电子邮件和作者日期。
git log --pretty=format:"%ae %ai" | sort | awk 'contributor == $1 { lastContribution = $0 } contributor != $1 { contributor = $1; if (lastContribution) print lastContribution; print } END { print lastContribution }'

如果你想要提交者的邮件或提交日期,将%a替换为%c
如果你要姓名而不是电子邮件,请用%an替换%ae

2
要显示所有用户和提交数量,您可以使用以下命令:
git shortlog -sn

而您可以使用输出通过以下方式获取有关每个作者的信息:

git log --author=<pattern> 

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接