4

统计git提交行数的脚本

 3 years ago
source link: http://abcdxyzk.github.io/blog/2012/10/16/tools-git-count-lines/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

统计git提交行数的脚本

2012-10-16 14:15:00

可以保存为count.sh运行 ./count.sh your_name

#!/bin/sh
insert=0
delete=0
git log--author=$1--shortstat--pretty=format:""|sed/^$/d >.tmp.count

whilereadline ;do
current=`echo$line|awk-F',''{printf $2}'|awk'{printf $1}'`
insert=`expr$insert+ $current`
current=`echo$line|awk-F',''{printf $3}'|awk'{printf $1}'`
delete=`expr$delete+ $current`
done<.tmp.count

rm .tmp.count
echo$1$insertinsertions, $deletedeletions

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK