1.最近5次提交代码变更行数:
执行
git log -5 --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: 19, removed lines: 5, total lines: 14
2.统计指定人员zhangdaxian的代码变更:
执行
git log --author="zhangdaxian" --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: 10532, removed lines: 3703, total lines: 6829
3.统计20180720-20180804这段时间内代码的变更行数
执行
git log --after=2018-07-20 --before=2018-08-04 --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: 5482 removed lines : 2635 total lines: 8117