![](/img/trans.png)
[英]How to ensure that commit contains specific user info in a shared git repository instead of group email id?
[英]How to find which tag in a git repository contains a specific commit
使用如下命令,我确定某个函数何时首次出现在git存储库中。
git log -Sfoo
我想要确定的是,这首先出现在哪个标签中。
因此,例如在node.js存储库中,每个版本都有标记,因此我想确定哪个版本中有函数foo。
git log会给我提交哈希,然后我会用它来查找它出现的第一个标记。
谢谢!
您可以像使用镐一样找到提交,然后使用......
git tag --contains <sha1>
我不确定顺序,但如果它是第一个,你可以通过head -1
管道。
你可以用一个错误的命令找到它......
git tag --contains $(git log --format="%H" -1 -Sfoo) | head -1
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.