The best Git tags Tutorial In 2024, In this tutorial you can learn Git tags

Git tags

If you reach an important stage, and hope will always remember that special submit snapshots, you can use it to git tag to tag.

For example, we want to project our w3cschoolcc publish a "1.0" version. We can use git tag -a v1.0 commands to the latest submission marked (HEAD) "v1.0" label.

-a option is meant to "create a label annotated." -a Option can not be executed, but it does not record this tag is Shashi Hou play, who to play, and will not let you add a tag comment. I recommend to create a label has been annotated.

$ git tag -a v1.0 

When you run git tag -a command, Git will open your editor that lets you write a comment tag, just like you to submit written comments the same.

Now, pay attention when we execute git log --decorate, we can see that we label a:

$ git log --oneline --decorate --graph
*   88afe0e (HEAD, tag: v1.0, master) Merge branch 'change_site'
|\  
| * d7e7346 (change_site) changed the site
* | 14b4dca 新增加一行
|/  
* 556f0a0 removed test2.txt
* 2e082b7 add test2.txt
* 048598f add test.txt
* 85fc7e7 test comment from w3cschool.cc

If we forget to submit a play tag, which in turn released, we can give it an additional label.

For example, suppose we released submit 85fc7e7 (the last line of the previous example), but then forgot to give it to play tag. We can now:

$ git tag -a v0.9 85fc7e7
$ git log --oneline --decorate --graph
*   88afe0e (HEAD, tag: v1.0, master) Merge branch 'change_site'
|\  
| * d7e7346 (change_site) changed the site
* | 14b4dca 新增加一行
|/  
* 556f0a0 removed test2.txt
* 2e082b7 add test2.txt
* 048598f add test.txt
* 85fc7e7 (tag: v0.9) test comment from w3cschool.cc

If we want to see all tags can use the following command:

$ git tag
v0.9
v1.0

Specify the label information command:

git tag -a <tagname> -m "w3cschool.cc标签"

PGP signature label command:

git tag -s <tagname> -m "w3cschool.cc标签"
Git tags
10/30