Skip to content

Instantly share code, notes, and snippets.

@happyrobots
Created May 6, 2013 01:14
Show Gist options
  • Save happyrobots/5522827 to your computer and use it in GitHub Desktop.
Save happyrobots/5522827 to your computer and use it in GitHub Desktop.
#!/bin/bash
sorted_commit_counts=`git shortlog -ns`
echo
echo "Commit Statistics by Authors"
echo "================================================"
echo
i=1
while read -r line; do
commit_count=`echo "$line" | cut -f1`
author_name=`echo "$line" | cut -f2`
echo "$i. $author_name did $commit_count commits"
git log --author="$author_name" --pretty=tformat: --numstat | \
gawk '{ add += $1 ; subs += $2 ; loc += $1 - $2 } END \
{ printf "Added Lines: %s; Removed Lines: %s; Total Lines: %s\n",add,subs,loc }'
echo
i=$(($i + 1))
done <<< "$sorted_commit_counts"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment