Skip to content

Instantly share code, notes, and snippets.

@atuttle
Created May 6, 2011 14:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atuttle/959038 to your computer and use it in GitHub Desktop.
Save atuttle/959038 to your computer and use it in GitHub Desktop.
A shell script for getting stats about your git repo (lines committed in HEAD by comitter)
#!/bin/sh
# this script requires GNU-SED for the "-r" option.
# Get it via: sudo brew install gnu-sed
# command found at: http://stackoverflow.com/questions/4589731/git-blame-statistics/4590487#4590487
echo "Lines in HEAD by Committer:"
git ls-tree -r HEAD|sed -re 's/^.{53}//'|while read filename; do file "$filename"; done|grep -E ': .*text'|sed -r -e 's/: .*//'|while read filename; do git blame "$filename"; done|sed -r -e 's/.*\((.*)[0-9]{4}-[0-9]{2}-[0-9]{2} .*/\1/' -e 's/ +$//'|sort|uniq -c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment