如何按日期获得下一个git提交?
在Windows计算机上的脚本(MSBuild)中,我有一个提交的SHA1。 在同一分支机构中获取“下一个”(按日期)提交sha1的正确git命令是什么?
从tortoisegit中查看此示例日志:
在我的脚本中,我当前有4B60A7E877762F421DDEEEEEEEEE4EA0282A99C5B20E4A
。现在,我需要一个命令才能获得C0FB4C86C354CFE32C6D0F1753958B60DB7E086
。
In a script (msbuild) on a windows machine, I have the SHA1 of a commit.
What is the correct git command, to get the "next" (by date) commit SHA1 in the same branch?
Take a look at this example log from TortoiseGit:
In my script I currently have the 4b60a7e87762f421ddeee4ea0282a99c5db20e4a
. Now I need a command to get c0fb4c86c354cfe32c6d0f1753958ab60db7e086
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我最终编写了一个自定义的MSBUILD任务,该任务找到了前身。我将其发布,以防其他人派上用场。
根据Joanis的评论,我最终在GIT日志中查找下一个提交。因此,在我的msbuild-script中,我现在有一个目标,它可以找到下一个git commit并执行特定的目标
targettoexecutefornextgitCommit
,并将属性当前commithash
设置为下一个git的哈希值犯罪。所以看起来像:I ended up writing a Custom MSBuild-Task which finds the predecessor. I post it in case it might come in handy for someone else.
Based on the comments of joanis I ended up looking in the git log for the next commit. So in my msbuild-script I now have a target which finds the next git commit and executes a specific target
TargetToExecuteForNextGitCommit
and sets the propertyCurrentCommitHash
to the hash value of the next git commit. So this looks like: