Skip to content

Instantly share code, notes, and snippets.

@fkztw
Last active December 30, 2015 06:39
Show Gist options
  • Save fkztw/7791195 to your computer and use it in GitHub Desktop.
Save fkztw/7791195 to your computer and use it in GitHub Desktop.
from: http://lueewy.com/?p=37 fixed version, still ugly. [usage] sh ./git_commmit_line_count.sh [$author_name]
#!/bin/sh
insert=0
delete=0
git log --author=$1 --shortstat --pretty=format:""|sed /^$/d > .tmp.count
while read line
do
current=`echo $line|awk -F ',' '{printf $2}'|awk '{printf $1}'`
if [ -z "$current" ]; then
current=0;
fi
insert=`expr $insert + $current`
current=`echo $line|awk -F ',' '{printf $3}'|awk '{printf $1}'`
if [ -z "$current" ]; then
current=0;
fi
delete=`expr $delete + $current`
done < .tmp.count
echo $1 $insert insertions, $delete deletions
rm .tmp.count
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment