We can create a label to point to a critical period in software development, such as "v2.0" and "v3. 1" when the version number is updated, which will be more convenient for later review. The use of tag is very simple. The main operations are: viewing tag, creating tag, verifying tag and * * * enjoying tag.
1 View label
List all tags:
Git tag
Tags listed in this way are sorted alphabetically, regardless of creation time. If you only want to see some tags, you can limit them:
Git tag -l v 1. *
Only the version of 1.0 will be listed here.
2 Create a label
Create a lightweight label:
Git tag v 1.0
A tag created in this way is not accompanied by other information, so it is a tag with information:
Git label -a v 1.0-m "first edition"
The -m is followed by comment information, which will be very useful in the future. This is an ordinary label with a signature label:
Git label -s v 1.0-m "first edition"
Provided that you have the private key of GPG, just change the above A to S. In addition to tagging the current progress, we can also tag the previous submission:
# View previous submissions first
git log - oneline
# If there is such a submission: 8 a5 CB 2 update readme.
# Add a tag for him like this
Git tag -a v 1. 18a5cbc2
3 Delete the label
It's simple. After knowing the label name:
Git tag -d v 1.0
4 verification label
If you have a GPG private key, you can verify the label:
Git tag -v v 1.0
5*** Enjoy the label
When we execute git push, the tag will not be uploaded to the server. For example, now github, after creating the tag, git push can't see the tag on the github page. In order to enjoy these labels, you must do this:
Git push origin-label