Skip to content

Instantly share code, notes, and snippets.

@coltfred
Forked from non/contrib.sh
Last active August 29, 2015 14:22
Show Gist options
  • Save coltfred/d461d84abf2370353a21 to your computer and use it in GitHub Desktop.
Save coltfred/d461d84abf2370353a21 to your computer and use it in GitHub Desktop.
#!/bin/sh
git log --numstat | awk '/^Author: /{author=$0} /^[0-9]+\t[0-9]+/{n = $1 + $2; d[author] += n; t += n} END { for(a in d) { printf("%6d %6.3f%% %s\n", d[a], d[a] * 100 / t, a)}}' | sort -rn
# written less illegibly, it is:
#
# git log --numstat | \
# awk '
# /^Author: /{author=$0}
# /^[0-9]+\t[0-9]+/{n = $1 + $2; d[author] += n; t += n}
# END { for(a in d) { printf("%6d %6.3f%% %s\n", d[a], d[a] * 100 / t, a)}}
# ' | sort -rn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment