Question

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.

Était-ce utile?

La solution

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>

to get only the tag message by itself.

Autres conseils

I got just the message (but the message included some extraneous stuff like PGP signature and signed-off-by lines) when I said:

git show -s --format=%B <tag>

Note the -s.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top