Introduction to GIT Usage-4

Source: Internet
Author: User

Today to write the basic git part, the previous articles about the most basic usage, the following is the last basic usage, is the git tag


Like most VCs, Git can, of course, tag the version of a moment to make a special mark on the release, and let's look at the use of git tag.

1. List existing labels

git tag

This way, if there are tags in the project, it will be listed, similar to the following

$ git tag

v0.1

v1.1

...

The order of the labels does not indicate any problems, but simply in the basic order, if you are interested in a particular version of the tag, you can git tag-l ' v1.2.4.* ', this will also list this version may exist in the small version, v1.2.4.1, v1.2.4.2, ......

2. Create a new label

There are two types of git tags: lightweight and note-level

Lightweight is a good understanding, which is a no-change, a reference to a specific commit object

Note level is not the same, it is stored in the warehouse of a separate object, has its own checksum information, there are a lot of notes, of course, using the label recommended to use the note-level, in order to retain the relevant information

Tags with notes established: Git tag-a v1.8-m ' version 1.8 ', parameter-A is a note-level label,-M is also a description of the Label object, if you do not add-m,git will start the text editor to let you add, just like the commit code, after the establishment, git tag to see, of course, you can also use Git show v1.8 to see more detailed information


3. Sign the label

If you have your own private key, you can also use GPG to sign the label, change-A to-s can be

git tag-s v1.8-m ' my signed 1.8 tag ' later describes how to verify signed tags


4. Lightweight label

No parameters, directly tagged version can be


A good comparison of the two Git show messages above


5. Verify the Label

Using Git tag-v tag-name

This command invokes GPG to verify the signature, you need to have the signer's public key, and no error will be made.


6. Post-tagging

git log--pretty=oneline Remember, list each time the submission of simple information, after a commit, should be tagged, the results you forget, no relationship, now Plus is not too late

For example, in this commit DF8789DFAD9AD9F989AD8F98A9988A89A9D8 update all the Configure add tag, git tag-a v1.8df8789 plus the first few characters of the checksum commit object will be available


7. Share tags

By default, git push does not transfer the label to the remote server, it requires a command display, like push code to the remote server, GIT push Origin tag-name

For example, GIT push Origin v1.5

If you need to push all the tags you created, plus--tags

Git pushes Origin--tags so that all the tags are pushed to that branch, so that other people, after cloning a shared repository or pulling data, can see the tags.


Two tips

1. Auto-complete

2. Command aliases



Introduction to GIT Usage-4

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.