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
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.
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.
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>
or
git for-each-ref --format='%(contents)' refs/tags/<tag name>
to get only the tag message by itself, where latter one is some like the base command without --sort=-version:refname
.