一个统计每个人git代码提交行数的命令

进入项目目录

printf "%25s %10s %10s %10s\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 }'

posted @ 2023-03-21 20:40  致林  阅读(287)  评论(0编辑  收藏  举报