[英]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.