#!/usr/bin/env bashfor
worker in {0}
do
echo 'userName: '$worker
git log --author=$worker --since="{1}" --no-merges | grep -e 'commit [a-zA-Z0-9]*' | wc -l
git log --author=$worker --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
入参说明:
{0}:你的git账户名称,如果你不知道填写什么,你可以看一下你在提交代码后,git的提交日志,可以
查看到你提交的用户名
{1}:你想查某个时间后的代码量
打印说明:
新增代码总行数 删除代码总行数 最终有效代码总行数(新增-删除)
printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }
运行:
将脚本写入sh脚本文件中,放在有.git目录同级目录下,然后可以用git客户端自带的命令行工具:Git Bash
打开命令行窗体程序,输入:./你的脚本名,回车即可打印出结果