1. Learn center
  2. Software Development
  3. Guides
  4. Git tutorial
  5. 如何使用 Git
  6. 如何在 Git 中使用標籤
  7. 為標籤加註解
Git

Project and code management together.

Try it free

為標籤加註解

我們可以透過執行含有-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