为了账号安全,请及时绑定邮箱和手机立即绑定

git log --name-status HEAD ^ .. HEAD在Mac上显示先前的提交

git log --name-status HEAD ^ .. HEAD在Mac上显示先前的提交

温温酱 2021-04-01 12:45:34
我在Mac上进行开发,但是我有Windows VM,最终无法运行某些版本。非常简单。我让詹金斯(Jenkins)拉并每天构建该应用程序。在此脚本中,我需要获取一些元数据。我需要获取git服务器上分支的列表,如果有的话(因为分支可能没有提交),则需要最新提交的元数据。特别是提交者的电子邮件。通常,在我的Mac上,它很简单:git branch --all > branchesfor b in $(cat branches);do  git checkout $b  git log --name-status HEAD^..HEAD | grep Author | cut -d"<" -f2 | cut -d">" -f1 > email  echo $b > branch  python buildScript.py $(cat email) $(cat branch)  ; donerm email branchmv branches old_branches我注意到的问题是:在分支的新分支上,git log --name-status显示了提交,但HEAD ^ .. HEAD未返回任何结果。grep在Windows Cmd提示中不是有效的cmd。在Windows Cmd提示中,cut不是有效的cmd。我可能会找到grep并削减替代方案。有人可以解释为什么提交不会显示在Windows上吗?是否有内置的Python Utility可以在其中处理所有问题?我没有直接运行bash的问题,但是我认为python可以更加干净,因为我已经在运行python脚本来构建...编辑:我想要的最终状态是bash脚本(或python脚本),其操作如下:loop over all branches.if branch is new since the last time the script was run, and has at least 1 commit   run_a_python_script with the committers email and that branch.else if there were deleted branches since the last time it was run:   run_another_python_script with the branchelse   nothing happens because this script already ran once.我将其设置为每10分钟间隔一次。这很容易在Python或Bash中完成。
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 239 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号