Quick peek into your Git repo with GitStats

If you have ever thought about how your project grows over time its really easy to find out using some statistics tool for your repository of choice. I’m using Git mostly and have found GitStats project recently.

GitStats is a statistics generator for git (a distributed revision control system) repositories. It examines the repository and produces some interesting statistics from the history of it. Currently HTML is the only output format.

Generating statistics with GitStats is generally easy and straightforward but apparently not on Max OSX :). The problem is caused by ‘Gnuplot’ library which is not installed by default and its not easily installable from Brew or Ports.

Trying here and there, I have finally found a solution on how to easily install gnuplot on my Mac OSX 10.8.2. The whole process takes about 5 minutes (can differ depending on your internet connection and machine speed) and includes building gnuplot from source.
The whole process is described here:

Once you have your Gnuplot installed and you meet other dependencies for GitStats (like Python and Git naturally) all you have to do is to execute the gitstats command:

./gitstats ~/Documents/projects/erlang_projects/couchdb ~/Downloads/gitstats_couchdb

where ‘~/Documents/projects/erlang_projects/couchdb’ is the location of Git repository you want to analyze and ‘~/Downloads/gitstats_couchdb’ is the folder where you want to produce the results.

Depending on your machine speed and size of the project this can take some time, once the script finishes executing you can open up the ‘index.html’ page from the produced results folder:

open '/Users/kris/Downloads/gitstats_couchdb/index.html'

So what can we get with GitStats:

Here is a list of some statistics generated currently:

  • General statistics: total files, lines, commits, authors.
  • Activity: commits by hour of day, day of week, hour of week, month of year, year and month, and year.
  • Authors: list of authors (name, commits (%), first commit date, last commit date, age), author of month, author of year.
  • Files: file count by date, extensions
  • Lines: Lines of Code by date

Example screenshots generated for the CouchDB repository:

Kind of ugly as it is, GitStats is a tool allowing you to see how the project grows over time and how active is the development of some library/tool you are going to use from the open source world. Be warned though that this by no means is a tool to measure developers productivity, quality of the source code or anything else other then your code base size, number of developers working on the project and some general trends where the project is going.


For opensource projects there is another nice tool (available online as a web application) called Ohloh
You can see similar statistics straight away without installing anything on your machine:

Generated for CouchDB (direct link):

One response on “Quick peek into your Git repo with GitStats

Leave a Reply

Related Posts

    No Releated Posts