Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the git tag

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to use the git tag, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

The tag is used to mark a submission point and uniquely bind a fixed commitId, which is equivalent to specifying an alias for the submission record to facilitate the extraction of the file. You can label an important version, either an object or a simple pointer, but the pointer does not move.

For example, we want to release a "1.0" version for our runoob project. We can use the git tag-a v1.0 command to label the latest submission (HEAD) v1.0.

The-an option means "create an annotated tag". It can be executed without the-an option, but it doesn't record when the tag was typed, who typed it, and it won't let you add a tag comment. I recommend creating annotated tags all the time.

$git tag-a v1.0

When you execute the git tag-a command, Git will open your editor and ask you to write a tag comment, just as you would submit a comment.

Now, notice that when we execute git log-decorate, we can see our label:

* d5e9fc2 (HEAD-> master) Merge branch 'change_site' |\ | * 7774248 (change_site) changed the runoob.php* | c68142b modify code | / * c1501a2 removed test.txt, add runoob.php* 3e92c19 add test.txt* 3b58100 first version submission

If we forget to tag a submission and publish it, we can tag it.

For example, suppose we released the submit 85fc7e7 (the last line of the example above), but forgot to tag it at that time. We can now:

$git tag-a v0.9 85fc7e7 $git log-- oneline-- decorate-- graph* d5e9fc2 (HEAD-> master) Merge branch 'change_site' |\ | * 7774248 (change_site) changed the runoob.php* | c68142b modify code | / * c1501a2 removed test.txt, add runoob.php* 3e92c19 add test.txt* 3b58100 (tag: v0.9) first version submission

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

$git tagv0.9v1.0

Specify the label information command:

Git tag-a-m "runoob.com tag"

PGP signature label command:

Git tag-s-m "runoob.com tag" Thank you for reading this article carefully. I hope the article "how to use git tag" shared by the editor will be helpful to everyone. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report