Skip to content

Instantly share code, notes, and snippets.

@Korko
Created February 6, 2015 12:54
Show Gist options
  • Save Korko/ec8f808a373b17cb96f0 to your computer and use it in GitHub Desktop.
Save Korko/ec8f808a373b17cb96f0 to your computer and use it in GitHub Desktop.
Print list of git authors with total added lines, total removed lines, total lines really added and percent of participation over added lines
git shortlog -s | cut -f2 | while read a; do git log --author="$a" --pretty=tformat: --numstat | awk '{ add += $1 ; subs += $2 ; loc += $1 - $2 } END { print "'"$a"',"add","subs","loc }'; done | awk '{ print; split($0,a,","); total += a[2] } END { print "Total,"total",0,"total }' | sort -nrk2 -t',' | while read l; do a=`echo $l | cut -d',' -f1`; if [ "$a" == "Total" ]; then t=`echo $l | cut -d',' -f2`; fi; mt=`echo $l | cut -d',' -f2`; echo $l","`awk 'BEGIN { printf("%d", '$mt'/'$t'*100) }'`; done | tail -n +2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment