Finding most changed files in Git

前端 未结 9 1653
野的像风
野的像风 2020-11-29 15:24

How can I show files in Git which change most often?

相关标签:
9条回答
  • 2020-11-29 16:15

    You could do something like the following:

    git log --pretty=format: --name-only | sort | uniq -c | sort -rg | head -10
    

    The log just outputs the names of the files that have been changed in each commit, while the rest of it just sorts and outputs the top 10 most frequently appearing filenames.

    0 讨论(0)
  • 2020-11-29 16:16

    Old question, but I think still a very useful question. Here is a working example in straight powershell. This will get the top 10 most changed files in your repo with respect to the branch you are on.

    git log --pretty=format: --name-only | Where-Object { ![string]::IsNullOrEmpty($_) } | Sort-Object | Group-Object  | Sort-Object -Property Count -Descending | Select-Object -Property Count, Name -First 10
    
    0 讨论(0)
  • 2020-11-29 16:20

    you can use the git effort (from the git-extras package) command which shows statistics about how many commits per files (by commits and active days).

    EDIT: git effort is just a bash script you can find here and adapt to your needs if you need something more special.

    0 讨论(0)
提交回复
热议问题