Skip to content
Rewind is an intelligent archivist.
Branch: master
Clone or download
gilesbowkett Merge pull request #1 from mattvanhorn/patch-1
Change output to handle full names
Latest commit 5c428b9 Aug 18, 2015
Type Name Latest commit message Commit time
Failed to load latest commit information.
Gemfile primitive metric: counts authorship "events" per dev Apr 9, 2013 Merge pull request #4 from mvz/issue-3-fix-file-type-list Aug 4, 2015 license info Aug 1, 2015
merge-hashes.rb license info Aug 1, 2015

Rewind: git history analysis scripts

A small library of handy git analysis scripts roughly inspired by Gary Bernhardt's Destroy All Software screencasts, and extensively documented in my ebook Unfuck A Monorail For Great Justice.

Use these when you want to quickly generate meaningful history reports for git projects.


Run a statistics bash script against a git repository. For each filename, discover lines of code, number of commits, and the date of the first and the last commit. Then pull that into a spreadsheet app, sort by each metric, and get an idea which files are the most important files in the history of the project.

bash [dir] [filetypes] > stats.csv
open -a Numbers stats.csv

For example:

bash /ember-project "js" "handlebars"


bash /rails-project "rb" "haml" "coffee" "scss"


This is more tricky, and requires Ruby. First run the script to get a count of all the authorship events in the repo; then run the tally_authors.rb Ruby script to sort the authorship events by name.

You can do all that as a one-liner in bash like this:

ruby tally_authors.rb <(cd /project && /this_dir/ "js")

The code isn't tricky at all, and the output is easy to understand, but it's also easy to misconstrue. That's the tricky part. A developer could show up with few authorship events because they're new to a team, because they often do pair programming, because they prefer large commits to small ones, or for several other possible reasons. Exercise good judgement.

Also, where will examine multiple file types, and tally_authors.rb assumes you're only working with one type of file at a time. Pull requests welcome!

Caveat: Running this code against extremely large projects with very long histories (e.g. Rails) might be very slow.

Why Rewind?

Rewind is currently a key character in the IDW Transformers comics.


MIT license.

You can’t perform that action at this time.