In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly talks about "what are the differences between tag and branch of git". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn "what are the differences between tag and branch in git?"
Differences: 1. Tag is a point in a series of commit that can only be viewed and cannot be moved, while branch is a series of commit lines that can be extended. 2. Tag is static and branch is dynamic, so we should move forward.
The operating environment of this tutorial: Windows7 system, Git2.30.0 version, Dell G3 computer.
The difference between tag and branch
Git tag is a point in a series of commit that can only be viewed and cannot be moved. A branch is a series of commit wires in series.
Tag is static, branch is dynamic, move forward.
The usage of git tag
We often use git to create a tag when the code is sealed. Such an unmodifiable version of the historical code is like being sealed by us. It is very convenient for operation and maintenance to release and pull, or to manage the version of the code later.
Tag function of git
There are actually two cases of tagging under git.
Lightweight: it is actually a separate branch, or an immutable branch. A reference to a specific submission object
Annotated: it is actually a separate object stored in the warehouse, which has its own checksum information, including the name of the tag, the description of the tag, and the tag itself allows you to use GNU Privacy Guard (GPG) to sign or verify, e-mail address and date. Generally, we recommend using annotated tags to retain relevant information.
So we recommend the second form of label.
Create tag
Git tag-a v1.2-m 'release 1.2'
In the above command, we successfully created a local version v1.2 and added the note message 'release 1.2'.
View tag
Git tag
To display the note information, we need to use the show directive to see
Git show V1.2
But currently this tag is only submitted to the local git repository. How to synchronize to a remote code base
Git push origin-tags
If you just synchronize and find a fatal bug, you need to retype the version, and it's not too late.
Git tag-d v1.2
At this point, we have only deleted the local version of V1.2, but the online version of V1.2 still exists. What should we do? At this point, we can push an empty version of the same name offline to achieve the goal of deleting the online version:
Git push origin: refs/tags/V1.2
How do I get the remote version?
Git fetch origin tag V1.2
In this way, we can accurately pull a specified version. It is suitable for operation and maintenance students to deploy the specified version.
At this point, I believe you have a deeper understanding of "what are the differences between tag and branch of git?" you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.