The tag management of git tutorials

Source: Internet
Author: User

When we publish a version, we usually start with a tag in the repository , so that it's the only version that determines the time of the tag . Any time in the future, the version of a tag is taken out of the historical version of that tag. Therefore, the tag is also a snapshot of the repository.
Git's tag is a snapshot of the repository, but it's actually a pointer to a commit, so creating and deleting tags is instantaneous.

The label means: "I'm looking for the commit ID is 892b892a3f7 ... That version of "" How to find a bunch of messy numbers? "The Commit ID I'm looking for is hit tag" v1. 1 " the version of" "Found: Git show v1. 1"
Create a label

Tagging in Git is easy, first, switching to a branch that needs to be labeled :


then, tap the command git tag <name> to hit a new tag:

You can view all tags with the command git tag:

The default tag is on the most recently committed commit . Sometimes, if you forget to tag, for example, now is Friday, but should be in Monday hit the label did not hit, how to do?
The method is to find the commit ID submitted by the historyand then hit it:

For example, to tag the add merge submission, its commit ID is 6afec3b, and the command is typed:

then use the command git tag to view the tags:

Note that labels are not listed in chronological order, but are sorted alphabetically. You can use Git show <tagname> to view tag information:

as you can see, v0.9 does play on the Add merge submission.
You can also create a label with a description, specify the label name with-A,-m to specify the description text:

Use the command git show <tagname> to see the explanatory text:

(

Summary
Command git tag <name> to create a new tag, the default is head, you can also specify a commit ID;
Git tag-a <tagname>-M "Blablabla ..." to specify tag information;
Git tag-s <tagname>-M "Blablabla ..." can be signed with PGP tag;
command git tag to view all tags.
)

Action Label

If the label is wrong, you can also delete it:

Because the created labels are stored only locally, they are not automatically pushed to the remote. Therefore, the wrong tag can be safely deleted locally.
If you want to push a tag to a remote , use the command GIT push Origin <tagname>:

Or, all-in-one push is not yet pushed to the remote local label:


If the label has been pushed to the remote, to remove the remote label is a bit troublesome, first removed from the local:

Then, remove from remote . The Delete command is also push, but the format is as follows:

: refs/tags/v0. 9 to [email protected]:michaelliao/-[deleted]         v0.  9

To see if you really deleted the tag from the remote repository, you can check it out on GitHub.

(

Summary
Command GIT push origin <tagname> can push a local tag;
Command GIT push origin--tags to push all the local tags that have not been pushed;
Command git tag-d <tagname> can delete a local tag;
Command git push origin:refs/tags/<tagname> to delete a remote tag.
)

The tag management of git tutorials

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.