Finding most changed files in Git Finding most changed files in Git shell shell

Finding most changed files in Git


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.


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.


I noticed that bothMark’sandsehe’sanswers do not --follow the files, that is to say they stop once they reach a file rename. This script will be much slower, but will work for that purpose.

git ls-files |while read aado  printf . >&2  set $(git log --follow --oneline "$aa" | wc)  printf '%s\t%s\n' $1 "$aa"done > bbechosort -nr bbrm bb