Click here to Skip to main content
13,253,863 members (66,637 online)
Click here to Skip to main content
Add your own
alternative version


6 bookmarked
Posted 17 Oct 2014

Set and Run gitstats on Your Windows Machine

, 17 Oct 2014
Rate this:
Please Sign up or sign in to vote.
Help you set and run gitstats on your windows


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.


I've tried to run this a couple of times, for no avail. There wasn't a straight up tutorial I could find on how to do it, so having wasted the time to do it, I hope this will save others some time.


There are several things you'll need in order to make this work.

1. Gitstats

You can find the sourceforge project page here, and the github code is sitting here.

Get the code, and simply unzip it into any folder on your computer.

Once you did this, go into the folder and rename the file "gitstats" to "".

2. Git

I'm assuming you have this installed, since otherwise, I doubt you'll be having any git projects to be running this on :).

According to the documentation, you should have a git version >= I'm currently using 1.9.2 . If you're having an older version, it's time to upgrade :).

(To check the git version you are running, just type "git --version" in the command prompt.:

3. Python

Head to the python homepage, and select the one that makes you happy, as long as you choose the 2.7.8 (Yep, I'm aware of the contradiction).

The documentation claims you need python >= 2.6 , but it seems this is not compatible with python 3. So ... pick the 2.7.8. I've got the windows installer, and just ran it. While you do it, make sure you choose the option to add python to path if you wan't to make your life easier.

3.1 Rapid Environment Editor (RapidEE)

Once you're done, you want to make sure you LOG OFF and back in, so the changes to the path are applied.

I suggest installing the above program (RapidEE), which is free, and lets you easily see what paths you have in your registry, and add/edit them if you want. Here's a screenshot of what it looks like:

4. Gnuplot

Gnu what ? Gnuplot !

Gnuplot is a free plotting library that makes pretty graphs. Head to their Homepage to get the latest version (4.6.5 at the time of writing, with version 5 supposedly coming out soon). According to documentation, any version >= 4.0.0 should work.

This seems to be all the hype amongst the academia people, graph nerds, and seemingly linux people who just seem to have it. It's pretty easy to pick if you want to, but for this tutorial, all you need is to have it installed.

Putting It All Together

Assuming you've followed the above steps, all you need is to go ahead and get your pretty stats and graphics.

Fire up a command prompt and type in "python". You should see a prompt telling you which version you're running, and get a new command prompt that looks like : ">>>" . Hit Ctrl+Z, Enter, to get out of it.

This is just to make sure that python is installed and can be found by the system. It should look like this:

If that works, you'll have to navigate into the folder where you've installed gitstats. For this example, I'll use:

  • Gitstats sits in: "C:\Users\xxx\Desktop\gitstats"
  • The git repository I want to clone: "C:\Users\xxx\Desktop\AwesomeProject"
  • The output directory: "D:\My Stats\Html"

Whichever paths you're using, make sure you have write permissions to them, and that they exist.

  1. So, in your command prompt, enter:
    cd "C:\Users\xxx\Desktop\gitstats". 

    The quotes are used just in case you have a white space in your path, for example: "C:\Some Folder\gitstas" will not work without the quotes.

  2. The command is python source_of_git target_of_html and in our example will look like:
    python<code> "C:\Users\xxx\Desktop\AwesomeProject" "D:\My Stats\Html"

    Make sure you point to the folder which holds the .git folder inside of it, and not to the .git folder directly, or any of the branches underneath it. Also, the output directory should exist before you run this.

  3. Open your output directory, and you'll see a whole bunch of files. Simply double click on the one called: index.html and it should open in your default browser. Note that they suggest "any sensible browser", so if you're using netscape 3, YMMV.

    You should see something like:

Clicking on the different buttons will show you the stats and graphs.

Congratulations, you can go back to being productive.


Some of the things I've encountered where:

Problem: python runs into an infinite loop of errors.

Solution: Renaming "gitstats" to "" seems to help.

Problem : Python complains about a line which includes "wc -l".

Solution: I've added the path of the git binaries which include the wc command to my path, which seems to have solved it.

Wrapping up

That's it really. You should be able to see some basic stats and graphs and be the envy of your friends and the live of the party from this day on.

I hope you'll find this helpful, and that it'll save you some time.

If it does, please vote and feel free to leave a comment.


  • 18th October, 2014 - Initial release


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Software Developer
Australia Australia
Coding since I Remember myself ... went through Basic on Commodore 64 to C# on an 8 core i7... In between worked with c, c++, java, assembler, php, pascal, JScript, SQL based DB's and a bit of NoSQL as well.

Love software, and I'm usually fidgeting around with technology software and hardware on my free time.

You may also be interested in...


Comments and Discussions

GeneralMy vote of 5 Pin
clsmith612-Jan-16 11:28
memberclsmith612-Jan-16 11:28 
GeneralRe: My vote of 5 Pin
_Noctis_12-Jan-16 22:21
professional_Noctis_12-Jan-16 22:21 
GeneralGreat! Pin
rht34120-Oct-14 5:05
memberrht34120-Oct-14 5:05 
GeneralRe: Great! Pin
_Noctis_20-Oct-14 12:44
professional_Noctis_20-Oct-14 12:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.171114.1 | Last Updated 17 Oct 2014
Article Copyright 2014 by _Noctis_
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid