<< back to blog

Analyse Your Git Log With Ruby

May 10, 2010, ruby ~ git

The git log command is a powerful beast. Combined with a little bit of ruby code, you can quickly run off simple reports to get an understanding of a project in different ways.

I wrote a script called git-sniff.rb (see bottom of post) to analyse the git log of some current projects we're working on.

For example, using the yuml git repo, I can run the script it like this:

$ cd ~/code/yuml
$ ruby git-sniff.rb

It outputs the following:

tobinharris has made 196 commits over the last 343 days. 
It looks like he worked on the project during 75 of those days.

I've only spent 20 minutes on this rough script, but I'm sure it wouldn't take long to start getting some really useful metrics out of it.

So far it's less than 50 LOC, shown below:

You may also like...

blog comments powered by Disqus