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?
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.
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.
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.
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.
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With