How to get the title of the tag (not the commit) in git?

Viewed 499

I created a new release on github, with the title "First release" and version "1.0.0"

I try to get the title of this release in command line like this:

git tag -n99 1.0.0

Unfortunately I get the message of the commit, instead of "First release"

2 Answers

A tag is a git concept and can have only the message that is either supplied or prompted while creating.

A Release(doc) is a GitHub concept and is based on a git tag. The Release that is created on GitHub can be supplied with the Release title and that title is for the Release and not specifically the tag. Hence the tag doesn't have any information of the title supplied to the Release.

You are trying to get a Release metadata, title to be specific, using git tag, which is not possible.

You can try out GitHub's API to get Release related data.

GitHub release creates a lightweight tag. It does not contain a message at all, the title you enter is only readable via GitHub API.

You could create an annotated tag first (git tag -a ...), push it to GitHub and then proceed to create the release from that tag.

Related