git-author-stats (599B)
1 #!/usr/bin/env bash 2 3 script=$(cat << 'EOF' 4 NF == 1 { name = $1; commits[name] += 1 } 5 NF == 3 { plus[name] += $1; minus[name] += $2 } 6 7 END { 8 for (name in plus) { 9 print name "\t+" plus[name] "\t-" minus[name] "\t" commits[name] 10 } 11 } 12 13 EOF 14 ) 15 16 REVERSE=r 17 18 if [ -z $ASTATS_REVERSE ]; then 19 REVERSE="" 20 fi 21 22 23 (printf $'name\tadded\tremoved\tcommits\n'; 24 25 git log --numstat --pretty=$'%aN <%aE>' "$@" \ 26 | awk -F$'\t' "$script" \ 27 | sort --field-separator=$'\t' -k${ASTATS_SORT_COLUMN:-2} -g${REVERSE} 28 ) > /tmp/git-author-stats 29 30 column -t -s $'\t' /tmp/git-author-stats 31 rm /tmp/git-author-stats