打印git标签的消息 [英] Print the message of a git tag

查看:74
本文介绍了打印git标签的消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个git命令,该命令仅输出给定带注释标签的消息. >

几乎是可能:

I need a git command that would output only the message of a given annotated tag. It's almost possible with git tag -ln:

$ git tag -ln v1.3.7
v1.3.7          Here be annotations

只是我不希望一开始就使用标签和空格,而在此扔一个正则表达式感觉有点过头了.我可以使用任何内置标志吗?我正在使用git版本1.8.3.2.

It's just that I don't want the tag and whitespace in the beginning, and throwing a regex at this feels like overkill. Is there any built-in flag i could use? I'm using git version 1.8.3.2.

使用git进行给定提交的打印提交消息的某些答案使用git show --format=%B.我似乎无法将输出限制为仅消息,无论是提交还是标记.

Some of the answers at Print commit message of a given commit in git use git show --format=%B. I can't seem to restrict output to only the message, neither for commits or tags.

推荐答案

我不确定这需要什么版本的git,但是对于最新版本,您也可以执行以下操作:

I'm not sure what version of git this requires, but with recent versions you can also do:

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

仅获取标记消息.

这篇关于打印git标签的消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆