git log --pretty='%aN' | sort -u
git log --pretty='%aN' | sort -u | wc -l
git log --author="yourName" --pretty=tformat: --numstat | gawk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s removed lines: %s total lines: %s
", add, subs, loc }'
git log --pretty='%aN' | sort | uniq -c | sort -k1 -n -r | head -n 10
- 统计每个人,和上面统计结果一样,亲测非亲写(搬运工),单行脚本,自己感受下:
git log --shortstat --pretty="%cE" | sed 's/(.*)@.*/1/' | grep -v "^$" | awk 'BEGIN { line=""; } !/^ / { if (line=="" || !match(line, $0)) {line = $0 "," line }} /^ / { print line " # " $0; line=""}' | sort | sed -E 's/# //;s/ files? changed,//;s/([0-9]+) ([0-9]+ deletion)/1 0 insertions(+), 2/;s/(+)$/(+), 0 deletions(-)/;s/insertions?(+), //;s/ deletions?(-)//' | awk 'BEGIN {name=""; files=0; insertions=0; deletions=0;} {if ($1 != name && name != "") { print name ": " files " files changed, " insertions " insertions(+), " deletions " deletions(-), " insertions-deletions " net"; files=0; insertions=0; deletions=0; name=$1; } name=$1; files+=$2; insertions+=$3; deletions+=$4} END {print name ": " files " files changed, " insertions " insertions(+), " deletions " deletions(-), " insertions-deletions " net";}'