天天看點

git統計某一開發者送出代碼的增删改動行數和具體詳細的改動内容

git統計某一開發者送出代碼的增删改動行數和具體詳細的改動内容

git指令:

echo "統計結果" && git log --author="zhangphil" --after="2018-04-16 00:00:01" --before="2018-04-16 12:00:00" --pretty=tformat: --numstat | gawk '{ add += $1 ; subs += $2 ; loc += $1 - $2 } END { printf "增加行數:%s 删除行數:%s 變化總行數:%s\n",add,subs,loc }' && echo "詳情如下:" && git log --word-diff --author="zhangphil" --since="2018-04-16 00:00:01" --until="2018-04-16 12:00:00" -p --stat           

其實合并了兩條git指令一次性輸出:

git log --author="zhangphil" --after="2018-04-16 00:00:01" --before="2018-04-16 12:00:00" --pretty=tformat: --numstat | gawk '{ add += $1 ; subs += $2 ; loc += $1 - $2 } END { printf "增加行數:%s 删除行數:%s 變化總行數:%s\n",add,subs,loc }'            

這條git指令計算統計結果。

git log --word-diff --author="zhangphil" --since="2018-04-16 00:00:01" --until="2018-04-16 12:00:00" -p --stat
      

這條指令輸出詳情。

可以加上開發者(作者)限定篩選出具體某位開發者的代碼。