git代码统计

统计某一时间段内每个人的代码量

 git log  --format='%aN' | sort -u | while read name; do echo -en "$name\t"; git log --author="$name" --pretty=tformat:  --since ==2018-3-1 --until=2019-1-10 --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }' -; done

提示:更改上述代码,改写你需要的时间段

查看git上的个人代码量

git log --author="username" --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 }' -

提示:需修改username

查看仓库提交者排名前 3

git log --pretty='%aN' | sort | uniq -c | sort -k1 -n -r | head -n 3

贡献值统计

git log --pretty='%aN' | sort -u | wc -l

提交数统计

git log --oneline | wc -l

用户所有提交次数排名(包括提交次数)

git log --pretty='%aN' | sort | uniq -c | sort -k1 -n -r

时间段内某用户的提交数

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

猜你喜欢

转载自blog.csdn.net/weixin_33738578/article/details/87490310