Skip to content

Instantly share code, notes, and snippets.

@seangeo
Last active December 28, 2015 20:49
Show Gist options
  • Save seangeo/7559807 to your computer and use it in GitHub Desktop.
Save seangeo/7559807 to your computer and use it in GitHub Desktop.
Generate a histogram of file churn in a git repo.
#
# This was created by smashing together two scripts. One from Gary Bernhardt and one from Small Labs.
#
# See also https://github.com/garybernhardt/dotfiles/blob/master/bin/git-churn
# And http://www.smallmeans.com/notes/shell-history/
#
git log --all -M -C --name-only --format='format:' "$@" | sort | grep -v '^$' | uniq -c | sort | awk '{print $1 "\t" $2}' | sort -g | awk '{print $1}' | uniq -c | sort -rn --stable | awk '!max{max=$1;}{r="";i=s=60*$1/max;while(i-->0)r=r"#";printf "%15s files changed %5d times %s %s",$1,$2,r,"\n";}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment