赞
踩
目录
项目中有很多成员,如何查看各个时间段每个组员的代码提交量,下面简单介绍下。
cd到指定项目目录,或者直接文件打开到指定目录,然后Git Bash打开,如下图所示
printf "\n1. 项目成员数量:"; git log --pretty='%aN' | sort -u | wc -l
结果
git log --pretty='%aN' | sort | uniq -c | sort -k1 -n -r
git log --format='%aN' | sort -u | while read name; do echo -en "$name\t"; git log --author="$name" --after="2023-01-01 00:00:00" --before="2023-12-31 23:59:59" --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 }' -; done
结果
- printf "\n\n2. 按用户名统计代码提交次数:\n\n"
- printf "%10s %s\n" "次数" "用户名"
- git log --pretty='%aN' | sort | uniq -c | sort -k1 -n -r | head -n 5
- printf "\n%10s" "合计";
- printf "\n%5s" ""; git log --oneline | wc -l
-
- printf "\n1. 项目成员数量:"; git log --pretty='%aN' | sort -u | wc -l
-
- printf "\n\n2. 按用户名统计代码提交次数:\n\n"
- printf "%10s %s\n" "次数" "用户名"
- git log --pretty='%aN' | sort | uniq -c | sort -k1 -n -r | head -n 5
- printf "\n%10s" "合计";
- printf "\n%5s" ""; git log --oneline | wc -l
-
- printf "\n3. 按用户名统计代码提交行数:\n\n"
- printf "%25s +s = +s - %18s\n" "用户名" "总行数" "添加行数" "删除行数"
- git log --format='%aN' | sort -u -r | while read name; do printf "%25s" "$name"; \
- git log --author="$name" --pretty=tformat: --numstat | \
- awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "%15s %15s %15s \n", loc, add, subs }' \
- -; done
-
- printf "\n%25s " "总计:"; git log --pretty=tformat: --numstat | \
- awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "%15s %15s %15s \n", loc, add, subs }'
-
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。