获取两个提交之间的所有标记列表
问题描述:
我有两个提交哈希,并希望列出在这两个提交哈希之间以phinx-
开头的所有标记。我该怎么做?获取两个提交之间的所有标记列表
编辑:
这是我想出了。有没有更好的解决办法
git log --pretty=format:'%D' 35164f33..49085fbe | grep -o 'tag: phinx-[0-9]*'
答
如果你可以使用comm命令,看看这个解决方案
comm -23 <(git tag -l phinx-* --contains <sha1 start>) <(git tag -l phinx-* --contains <sha1 end>)
答
快速黑客可能是:
git log --oneline --decorate <sha1>..<sha1>|grep "tag:"| grep "phinx-"
一个实际的解决方案might be more complex,涉及git rev-list
。
+0
谢谢@VonC。快速解决方案也是我的第一个想法。 –
有趣的想法。谢谢。 –
我喜欢这个,因为这个模式只与标签名称匹配,并且只返回标签名称,而不是整个日志行 – Francesco
使用'comm'是我在答案中提出的[VonC在他的答案中链接](http: //*.com/a/36787860/1256452)。它应该可以正常工作,但请注意提及文档声明comm应该排序的声明。 (幸运的是'git tag -l'默认也是排序!) – torek