git 代码量统计

增加的代码行数量

git log --stat|perl -ne 'END { print $c } $c += $1 if /(\d+) insertions/'

精确的代码行修改数量:

git log --author="$(git config --get user.name)" --pretty=tformat: --numstat | gawk '{ add += $1 ; subs += $2 ; loc += $1 + $2 } END { printf "added lines: %s removed lines : %s total lines: %s\n",add,subs,loc }'

上面不行就这个:

git log --pretty=tformat: --numstat | gawk '{ add += $1 ; subs += $2 ; loc += $1 + $2 } END { printf "added lines: %s removed lines : %s total lines: %s\n",add,subs,loc }' 

你可能感兴趣的:(git 代码量统计)