显示git标签消息

时间:2013-07-08 17:04:27

标签: git tags

所以,

如果我这样做:

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

然后我跑:

git show v4.2

看到'我的消息'的内容,我看到了最后一次提交的消息。

如何查看该标记的消息?

1 个答案:

答案 0 :(得分:5)

来自git show documentation

  

对于标签,它显示标签消息和引用的对象。

所以你所描述的应该可以正常工作。这是一个完整的例子:

$ 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