Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Print the message of a git tag

Tags:

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.

like image 709
lime Avatar asked Feb 04 '14 19:02

lime


People also ask

How do I find my tag details?

To use Git to view details about Git tags in a local repo, run one of the following commands: git tag to view a list of Git tag names. git show to view information about a specific Git tag. git ls-remote to view information about Git tags in a CodeCommit repository.

What is git tag message?

Tags are ref's that point to specific points in Git history. Tagging is generally used to capture a point in history that is used for a marked version release (i.e. v1. 0.1). A tag is like a branch that doesn't change. Unlike branches, tags, after being created, have no further history of commits.

How do I see git tags?

Find Latest Git Tag Available In order to find the latest Git tag available on your repository, you have to use the “git describe” command with the “–tags” option. This way, you will be presented with the tag that is associated with the latest commit of your current checked out branch.


1 Answers

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.

like image 195
keitwb Avatar answered Oct 02 '22 11:10

keitwb