5

I've cloned a big repository, and I'd like to know on which files most of the work has been done.

Is there any git command which can display the list of files with total number of commits or something similar?

xuhdev
  • 8,018
  • 2
  • 41
  • 69
rishi
  • 121
  • 7
  • 1
    How do you define "most of the work"? The number of commits that has touched the file of interest or Lines of changes summed up among all commits? – xuhdev Feb 22 '20 at 01:24
  • Suppose there are 1000s of files, and to make things easy, I'd like to see the files on which developer has mostly worked. So, if a file has 100 commits and the other one has 80 commits, these two files should come in the list before other files which might have 20 or 30 commits. I hope this clears the question. – rishi Feb 22 '20 at 01:30

2 Answers2

3

I have some bash'y way to count how many commits per file.

 git log --name-only  --pretty=format: | sort | uniq -c | sort -nr
Tarek Dakhran
  • 2,021
  • 11
  • 21
0

This answer has some good suggestions: Finding most changed files in Git

The tool mentioned is git effort in the git-extras package, which can be installed with

sudo apt install git-extras

and run at the root of a git project with the command

git effort

It shows the path to the file, the number of commits affecting the file, and the number of days (active days) in which those commits occurred. In other words, it tries to approximate the effort put into each file in a project over time. It's also color coded.

If you would rather use the raw bash script to do this instead of using a package manager, it has a github page here.

tlake29
  • 121
  • 2
  • 5