打印git标签的消息

时间:2014-02-04 19:37:56

标签: git git-tag

我需要一个git命令,它只输出给定注释标签的消息。 git tag -ln

可能几乎
$ git tag -ln v1.3.7
v1.3.7          Here be annotations

这只是我在开始时不想要标签和空格,并且在此处抛出正则表达式就像是矫枉过正。我可以使用任何内置标志吗?我正在使用git版本1.8.3.2。

Print commit message of a given commit in git的部分答案使用git show --format=%B。我似乎无法将输出限制为仅用于提交或标记的消息。

2 个答案:

答案 0 :(得分:5)

我不确定这需要什么版本的git,但是你也可以使用最新版本:

git tag -l --format='%(contents)' <tag name>

单独获取标记消息。

答案 1 :(得分:1)

当我说:

时,我收到了消息(但消息中包含了一些无关紧要的内容,如PGP签名和签名关闭行)。
git show -s --format=%B <tag>

请注意-s

相关问题