简体   繁体   English

Git:如何在提交合并到master时找到?

[英]Git: How to find when a commit was merged into master?

I want to create a metric in my project that measures how long does a commit take from its creation till to get into the master branch? 我想在我的项目中创建一个度量标准,用于衡量提交从创建到主分支需要多长时间?

Is it possible? 可能吗? It looks like for fast-forwarded commits I can't get this info from the git log. 对于快速转发的提交,我看起来无法从git日志中获取此信息。

If I can get a snapshot of the repository X days ago, maybe I can calculate it. 如果我可以在X天前获得存储库的快照,也许我可以计算它。 Another option is to get a log that registers when a branch HEAD was modified. 另一种选择是获取在修改分支HEAD时注册的日志。

Update: If you create an annotated tag at each release, you can just see the date of the tag that included the commit. 更新:如果在每个版本中创建带注释的标记,则只能看到包含提交的标记的日期。 Here is how to list the commits included in a tag 以下是列出标记中包含的提交的方法

It is not easy, considering the commit itself does not know in which branch it is. 考虑到提交本身并不知道它在哪个分支中,这并不容易。
It does not keep track of branch "events" which would mention it was created in branch X, and then merge (possibly fast-forward) in branch Y. 它不会跟踪分支“事件”,它会提到它是在分支X中创建的,然后在分支Y中合并(可能是快进)。

Only git reflog registers HEAD changes, but it is limited in time . 只有git reflog注册了HEAD更改,但它的时间有限

As mentioned by the OP, you need to add a metadata (like an annotated tag , but you could also consider a git notes ) in order to memorize the information you need. 如OP所述,您需要添加元数据(如带注释的标签 ,但您也可以考虑使用git notes )以记忆您需要的信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Git:如何找到合并提交的分支? - Git: How to find which branches a commit was merged into? Git:合并主分支时触发“机器人”提交 - Git: trigger a "robot" commit when a master branch is merged Git Hook:如何判断已标记的提交是否已合并到master - Git Hook: How to tell if tagged commit has been merged to master 如何以编程方式找到已使用git合并到master的分支? - How to programmatically find branches that were merged into master with git? Git:如何找到所有从未合并回master的分支 - Git: How to find all branches that were never merged back into master 你如何找到谁将一个 git commit 合并到一个分支中? - How do you find who merged a git commit into a branch? 在 master 中找到最后合并的 git 分支 - find last merged git branch in master 如何将远程主服务器重置回尚未与git中的另一个分支合并的提交 - How to reset remote master back to a commit which has not been merged with another branch in git 如何从Git的master分支中排除特定合并分支的提交? - How to exclude a specific merged branch's commit from the master branch in Git? Git - 如何从提交哈希中获取Pull Request(PR未合并为master)号码 - Git - how to get Pull Request (PR not merged to master) number from commit hash
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM