Git代码行数统计命令

统计zhangsan在某个时间段内的git新增删除代码行数
git log --author=zhangsan--since=2018-01-01 --until=2019-04-01 --format='%aN' | sort -u | while read name; do echo -en "$name\t"; git log --author="$name" --pretty=tformat: --numstat | grep "\(.html\|.java\|.xml\|.properties\)$" | 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 --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 }'

猜你喜欢

转载自www.cnblogs.com/supiaopiao/p/10943882.html