In general, when we release a new version to the online server, we make a tag in the repository, and we determine that a version will be posted online. We can view this tag version at any time, which means that the tag is actually a snapshot in the repository. The simple tag is that the needle pointing to a commit is similar to the point of the branch we spoke before, but the difference is that the branch is mutable and the label is immutable. So, we create and delete tags very quickly. OK , let's show you how to create a label.
Third, create a label
Creating tags in git is easier with the git tag command, but it's important to note that we typically tag and post on the master. such as:
The first is to switch to the project directory: Cd/f/gitworkspace/firstgitproject
View branches: Git branch
Switch to master: Git checkout Master
Tagged with: git tag version1.0
View Tags: git tag
We have a tag that is on the latest commit, so we don't want to put the tag on the latest commit. such as:
View all commits: Git log--pretty=oneline--abbrev-commit
Tag a commit: Git tag version0.5 3cba4ce
Show details of the submission: Git show version0.5 (tag number)
We first use the git log command to see our commit ID, and then tag it with a git tag commit ID. It's easy for everyone to see, hey. Let's take a look at the label for specific information. Such as
Below we create a label with a description, specify the label name with-A,-m specifies the description. such as,
Build a label with description: Git tag-a ver0.5-m "release version 0.5" 8dba382
Let's first show you how to delete a tag, such as:
Delete Tags: git tag-d ver0.5
Because the labels we create are only stored locally, not remotely. Therefore, the wrong tag can be deleted quickly. So we push the label to the remote, what do we do? Such as:
Push a tag to the remote: Git push Origin ver0.5
Push all tags to remote: Git push Origin--tags
As you can see, we've demonstrated two methods, the first of which we push a tab at a time, and the second way we push all the tags. Now that our tag has been pushed to the remote, how do we delete the tag? The step is this, we first delete the local label and then delete the remote label. Such as:
Delete local tags first: git tag-d ver0.5
Remove remote tags: git push origin:refs/tags/ver0.5
So the remote git server tag is deleted, below we go to the remote GIT server verification, such as:
W
You can see that the remote git tag is actually deleted, hey. Well, here we have the management of the label is completed, let us summarize it.
V. Summary
1. Create a label
git tag name is used to create a new label, the default is head, or you can specify a commit ID
git tag-a tagname-m "" To specify tag information
git tag to see all tags
Git show can view tag details
2. Manage tags
Git push origin tagname can push a local tag
Git push origin--tags can push all the local tags that have not been pushed
Git tag-d tagname can delete a local tag
git push origin:refs/tags/tagname can delete a remote tag
git tag Management