代码统计工具:GitStats
- 按照文件类型统计每个人的代码量:
git log --format='%aN' | sort -u | while read name; do echo -en "$name"; git log --author="$name" --pretty=tformat: --numstat | grep "\(.c\|.h\|.sh\)$" | 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 log --format='%aN' | sort -u | while read name; do echo -en "$name"; git log --author="$name" --pretty=tformat: --numstat | grep "\(.py\)$" | grep -vw "testcase/lib" | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf " added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }' -; done