如何在特定分支的Git存储库中获取开发人员一天提交的提交

use*_*278 5 git shell

我试图发送一个报告,其中包含开发人员每天在git存储库中完成的提交计数.

#read all the inputs
read -p "Enter the Branch Name:" branchname
read -p "Enter the from date:" frmdate
read -p "Enter the To date:" todate

#execute the command to get the commit history
git log origin/$branchname --name-status  --pretty=format:"%cn committed %h on %cd full" --after="$frmdate 00:00" --before="$todate 23:59" --decorate |  git shortlog -s -n > history.txt
Run Code Online (Sandbox Code Playgroud)

这个脚本帮助我创建一个文件,其中包含在给定日期更改的文件和由谁更改的文件.但我需要由独立开发者提交的提交数量.

我尝试过git shortlog -s -n,它给出了所有分支机构中开发人员的总体提交次数.

需要创建报告以每天获取每个开发人员的提交计数

eft*_*ft0 3

嗯......我会做的是:

  • 获取自昨天以来在该分支工作的开发人员列表。
  • 将该列表传输一段时间,以便您可以了解每个人所做的事情

它会是这样的:

the_date=$( date +%F )
git log --pretty="%ae" --since=yesterday the-branch | sort | uniq | while read author; do
    git log --author=$author --since-yesterday the-branch > "$the_date"_"$author".txt
done
Run Code Online (Sandbox Code Playgroud)

如果您需要更多信息(例如已更改的文件等),只需在 while 循环内的日志调用中添加更多选项即可。