문제

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>

to get only the tag message by itself.

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top