Generate Git development statistics
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

NOTE This project has been deprecated in favour of statgit2.


statgit is a PHP script to generate Git development statistics, similar to the statistics generated by StatSVN.

statgit uses cloc to obtain lines of code, and this needs to be installed.

Note: This is under development, there is lots of data and statistics being collected and more reports will be generated soon.


  1. Install php and cloc
  2. Clone statgit
  3. Execute composer install in your statgit directory to generate the vendor/autoload.php file
  4. Clone your target Git repository to a working directory, that statgit will interact with directly
  5. Execute statgit and wait
php -f statgit/statgit.php ~/openclerk --output ~/openclerk-stats/

statgit will pull the latest Git origin/master to the working directory (in this case, ~/openclerk), and then individually check out each commit and execute cloc to generate file statistics.

After each commit check out has successfully completed, the statgit database is automatically saved (by default to <working_dir>/database.json). The statgit process can be cancelled at any time and resumed later. This also makes it much faster on subsequent startups.

statgit handles force pushes as well; it only considers the commits referenced in the latest git log when generating statistics.

Command line options

  • --output [dir]
  • --database [file.json]
  • --last [n] - only parse last n commits
  • --skip_git
  • --debug
  • --timezone [s] - use s as the timezone, defaults to "UTC"

To increase PHP's memory limit, use php -d memory_limit=2400M -f statgit.php [options].

Ideas for future work

  • For large code bases: use --last to restrict the number of commits.
  • For generating specs of just your specs, for example: use <project>/spec instead of <project>
  • For removing directories before running any specs: use --without dir1 --without dir2


Running tests