1

I want to have some statistics about my project and what the team has done over the past years. I know there's git log --stat <file name> which gives you a log with all the modifications that were made on that specific file. Is there a way to run this git log --stat on every file of my project and output to a file?

Thank you.

1
  • Well I know git log --stat gives you a detailed output with commit message and all, but I'm ok with only number of changes on each file for instance. Commented Apr 19, 2018 at 9:46

1 Answer 1

1

There is not a native way to do this in git, however there are two projects that add this functionality by parsing git commands of may git commands. Both are called git fame one is implemented in ruby and one is implemented in python. While the are called the same thing, they have slightly different feature sets.

Instead of parsing git log, however the both parse the results of git blame in porcelain mode iterating over all the files tracked via git ls-files.

Git Fame Python sample output:

Blame: 100%|███████████████████████████████████| 11/11 [00:00<00:00, 208.43it/s]
Total commits: 302
Total files: 37
Total loc: 3134
+----------------------+------+------+------+----------------+
| Author               |  loc | coms | fils |  distribution  |
+======================+======+======+======+================+
| Casper da Costa-Luis | 3123 |  297 |   35 | 99.6/98.3/85.4 |
| Not Committed Yet    |    7 |    4 |    2 |  0.2/ 1.3/ 4.9 |
| Evïan Etàcidñys      |    4 |    1 |    1 |  0.1/ 0.3/ 2.4 |
+----------------------+------+------+------+----------------+

Git Fame Ruby sample output:

Statistics based on master
Active files: 21
Active lines: 967
Total commits: 109

Note: Files matching MIME type image, binary has been ignored

+----------------+-----+---------+-------+---------------------+
| name           | loc | commits | files | distribution (%)    |
+----------------+-----+---------+-------+---------------------+
| Linus Oleander | 914 | 106     | 21    | 94.5 / 97.2 / 100.0 |
| f1yegor        | 47  | 2       | 7     |  4.9 /  1.8 / 33.3  |
| David Selassie | 6   | 1       | 2     |  0.6 /  0.9 /  9.5  |
+----------------+-----+---------+-------+---------------------+
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you. Having no answer back when I asked, I managed to accomplish this with a small shell script, but I like this Git Fame. I'll look into it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.