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