Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Showing git tag message

Tags:

git

tags

So,

If I do this:

 git tag -a v4.2 -m 'my message'

And then I run:

git show v4.2

Insead of seeing 'my message', I see the message of the last commit.

How can I see the message of that tag?

like image 201
Hommer Smith Avatar asked Jul 08 '13 17:07

Hommer Smith


People also ask

How do I see a git tag message?

To view the code as it was at that commit, choose the Git tag name. To view details of the commit, including the full commit message, committer, and author, choose the abbreviated commit ID.

How do I edit a tag message in git?

The message is taken from file with -F and command line with -m are usually used as the tag message unmodified. This option lets you further edit the message taken from these sources.

How do I view tags on GitHub desktop?

Viewing tagsClick History. Click the commit. Note: GitHub Desktop displays an arrow if the tag has not been pushed to the remote repository. All tags associated with the commit are visible in that commit's metadata.

What does git tag mean?

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.


2 Answers

From the git show documentation:

For tags, it shows the tag message and the referenced objects.

So what you've described should work fine. Here's a complete example:

$ git init
Initialized empty Git repository in /Users/carl/Desktop/example/.git/
$ touch file
$ git add file
$ git commit -m "added a file"
[master (root-commit) 198fa55] added a file
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 file
$ git tag -a sometag -m "tag message"
$ git show sometag
tag sometag
Tagger: Carl Norum <somebody@somewhere>
Date:   Mon Jul 8 10:10:49 2013 -0700

tag message

commit 198fa55868770ab78786e704dbb290cbeefac011
Author: Carl Norum <somebody@somewhere>
Date:   Mon Jul 8 10:10:42 2013 -0700

    added a file

diff --git a/file b/file
new file mode 100644
index 0000000..e69de29
like image 69
Carl Norum Avatar answered Sep 29 '22 10:09

Carl Norum


You need to use the -n option with either 'git -l' or 'git tag'. This will show all tags with (the first line of) their messages:

git tag -n

-n takes an optional number of lines of the annotation to display, it defaults to one. From the git tag reference:

-n<num>

<num> specifies how many lines from the annotation, if any, are printed when using -l. Implies --list.

The default is not to print any annotation lines. If no number is given to -n, only the first line is printed. If the tag is not annotated, the commit message is displayed instead.
like image 21
SteveAz Avatar answered Sep 29 '22 10:09

SteveAz