首页 > 代码库 > 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

git代码量统计(转载)