git代码量统计(转载)

git统计某人代码量

 

指定用户名版

git log --author="your_name_here" --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }'

 

结果示例:
added lines: 132986, removed lines: 1095369, total lines: -962383

扫描 Log 单独统计每个人的增删行数加强版

git log --format='%aN' | sort -u | while read name; do echo -en "$name\t"; git log --author="$name" --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }' -; done

posted @ 2017-06-01 23:51  OFreedom  阅读(658)  评论(0编辑  收藏  举报