当前位置:   article > 正文

统计Git项目各成员贡献量(代码行数、提交次数)_gitlab统计贡献者代码量

gitlab统计贡献者代码量

使用方法

在项目的文件夹中,右键,选择Git Bash Here
在这里插入图片描述
会弹出命令行

在这里插入图片描述
使用下面的代码去统计

统计指定用户的提交代码行数

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 }' -
  • 1

统计所有贡献者提交代码行数

git log --format='%aN' | sort -u | while read name; do echo -en "$name\t"; git log --author="$name" --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
  • 1

统计所有贡献者的提交次数

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

统计指定时间内某贡献者的提交行数

git log --author="xxx" --since='2023-06-18 00:00:00' --until='2023-08-15 23:00:00' --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 }' ```

  • 1
  • 2
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Gausst松鼠会/article/detail/243920
推荐阅读
相关标签
  

闽ICP备14008679号