Git log 统计分析
统计个人增删行数 git config user.name git log --author="zhaoyifan" --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: 82813, removed lines: 53707, total lines: 29106 统计每个人增删行数 git log --shortstat | grep -E "(Author: )(\s*(\w+)){2}|fil(e|es) changed" | awk ' { if($1 ~ /Author/) { author = $2" "$3 } else { files[author]+=$1 inserted[author]+=$4 deleted[author]+=$6 } } END { for (key in files) { print "Author: " key "\n\tfiles changed: ", files[key], "\n\tlines inserted: ", inserted[key], "\n\tlines deleted: ", deleted[key] } } ' 统计每个人提交次数 git shortlog -sn --no-merges 忽略某些路径的更改 git log -- . ":(exclude)sub" git log -- . ":!sub" cloc AlDanial/cloc - cloc counts blank lines, comment lines, and physical lines of source code in many programming languages. ...