简体   繁体   中英

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:

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 ( '' )
  • --name-only : print name of changed files only
  • sort | uniq -c sort | uniq -c : group file names and count number of occurrences (= number of commits modifying the file)
  • sort -n : numerical sort by number of modifications

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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