Skip to main content
  1. Learn center
  2. Software Development
  3. Guides
  4. Git tutorial
  5. 如何使用 Git
  6. 如何在 Git 中使用标签
  7. 为标签加注释
GuidesSoftware DevelopmentBacklog
Git

Project and code management together.

为标签加注释

我们可以通过运行带有-a选项的 git tag 命令来为标签添加注释,这将打开默认的文本编辑器,让您添加注释。

如果您想在标签创建的同时添加注释,您也可以使用-am选项。

运行以下命令,为 HEAD 添加一个名为tag2的标签,并附上一些注释:

$ git tag -am "Simple Git tutorial for beginners" tag2

使用-n选项将为您提供标签列表及其对该存储库的注释。

$ git tag -n
  tag1           first commit
  tag2          Simple Git tutorial for beginners
Add a tag with an annotation "tag2" to a commit which HEAD is pointing out now.

Subscribe to our newsletter

Learn with Nulab to bring your best ideas to life