A few years ago I took part in a project with a few collaborators, and I had a slightly atypical question. I wanted to know (approximately) how much each of the participants contributed to the final product. Since we tracked it in Git, the information is obviously there – for example, I can run git blame
on every file in the project and see which line was contributed by who. (Important caveat: in reality, it’s “last touched” instead of “contributed”. If someone commits the line saying console.log("Hello world!")
and then I run Eslint on it and change it to console.log("Hello world!");
, the line counts as “mine”. This simple example shows that all statistics extracted from Git history must be taken with a solid grain of salt.)
Happily, someone created git-quick-stats, a tool which enables just that. When you install it and run git quick-stats
in your repo, you are presented with a menu of about a dozen choices. I have to admit that I’m not sure about the meaning of some of them, but I still find a few of them very interesting. Of course, there is the first one – Contribution stats (by author)
– which is pretty self-explanatory (and very detailed). There is also All branches
(sorted by most recent commit)
, which can be pretty useful to determine which branches are safe to delete. You can also list all the contributors alphabetically. I found this especially useful when I wanted to clean up the authors’ names using the mailmap file. Another fascinating thing to see is the Git commits per hour
chart – for example, at my day job all the contributors live in the same timezone, so the chart looks slightly boring, but it’s pretty nice to see that we seldom finish work at home. I also took a peek at my personal distribution of commits per hour using Git commits by author
per hour
(note: you apparently need to type in the email then) and saw a funny pattern of over 30 commits done between 5 and 6 am (my favorite time to work on my hobby projects, but also the job project from time to time).
That’s it for today!