1. 程式人生 > >git檢視commit提交次數和程式碼量

git檢視commit提交次數和程式碼量

檢視當前分支所有提交者及其提交次數,按次數由高到低排序

具體命令如下:

git log | grep "^Author: " | awk '{print $2}' | sort | uniq -c | sort -k1,1nr

現在每個月專案組要統計工作績效,要提交每個月的git提交數目,所以整理了個指令碼:

git log --author=yourname --since="2014-07-01" --no-merges | grep -e 'commit [a-zA-Z0-9]*' | wc -l

分析 Git 日誌來統計程式碼量

指定使用者名稱版

git log --author="_your_name_" --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: 38861, removed lines: 22916, total lines: 15945