鉴于git存储库中的特定文件,我将如何查找该文件中最常见的提交者?
答案 0 :(得分:10)
您可以使用git shortlog:
git shortlog -sn -- path/to/file
这将打印出路径的作者列表,按提交计数排序和作为前缀。
通常,此命令用于快速汇总更改,例如生成更改日志。使用-s
,更改摘要将被删除,仅保留作者姓名。并与-n
配对,输出按提交计数排序。
当然,您也可以使用目录路径来查看该路径的提交,而不是文件路径。如果您完全离开路径,git shortlog -sn
会为您提供整个存储库的统计信息。
答案 1 :(得分:2)
您可以根据每个用户的提交次数来缩短输出。
$ git shortlog -sen <file/path>
Here,
-s for commit summary
-e for email
-n short by number instead of alphabetic order
// more info
$ git shortlog --help
答案 2 :(得分:1)
$ git log --follow <file> | grep "Author: " | sort | uniq -c | sort
一些解释:
git log --follow <file>
- 将日志限制为特定文件,按照此文件的所有重命名进行操作
grep "Author:" | sort
- 只与作者和小组作者合作
uniq -c | sort
- 将作者分组并再次排序,因此最常见的是第一行
:)
答案 3 :(得分:1)
$areo = get_field('areo');
$stiffness = get_field('stiffness');
$weight = get_field('weight');
$comfort = get_field('comfort');
获取每个提交,组和计数的提交者名称,按降序排序。