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
对修改封闭,向扩展开放,我反而更向往自由