代碼統(tǒng)計(jì)工具:GitStats
- 按照文件類型統(tǒng)計(jì)每個人的代碼量:
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