简体   繁体   English

计算git项目中所有文件的所有修订

[英]Count all the revisions for all files in a git project

Is there a git command that can output for every file in a project something like this or similar to it: 是否有git命令可以为项目中的每个文件输出类似或类似的内容:

20 file1
43 file2 etc.

I'm interested to see how many times was each file modified by any author, not just for a specific one. 我很想知道每个作者修改了每个文件多少次,而不仅仅是针对特定文件。

To get a sorted list of all files and the number of commits that modifies them: 要获得所有文件的排序列表以及修改它们的提交次数:

git log --pretty='' --name-only | sort | uniq -c | sort -n
  • --pretty='' : do not output commit information ( '' ) --pretty='' :不输出提交信息( ''
  • --name-only : print name of changed files only --name-only--name-only打印更改文件的名称
  • sort | uniq -c sort | uniq -c : group file names and count number of occurrences (= number of commits modifying the file) sort | uniq -c :组文件名和计数出现次数(=修改文件的提交次数)
  • sort -n : numerical sort by number of modifications sort -n :按修改数量进行数字排序

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM