公司要统计每天代码提交行数,借助git统计
在项目根目录,右击选择Git Base Here

然后在面板中输入如下命令:
1、根据时间来统计
git log --since=2023-02-23 --until=2023-02-24 --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 }'
2、根据时间、用户名来统计,username 换成用户名
git log --author="username" --since=2023-02-23 --until=2023-02-24 --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 }'
3、根据用户名筛选,username 换成用户名
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 }'
结果:

网友评论