git tag Management

Source: Internet
Author: User
Tags gnupg gpg

When we publish a version, we usually make a tag in the repository, so that the only version of the tag is determined, in the future whenever, the version of a tag is

Take out the historical version of the tagged moment, so the tag is a snapshot of the repository, and Git's tag is a snapshot of the repository, but it's actually a pointer to a commit.

(like a branch, but the branch can be moved, the label cannot be moved), so creating and deleting a label is done in a flash.

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

Enter git tag name to make a new tag:

$ git Tag v1.0

You can use the command git tag to see all the tags:

$ git tag
v1.0

The default tag is on the most recently committed commit. Sometimes, what if you forget to tag?

The way to do this is to find the commit ID of the history commit, and then hit it.

$ git log--pretty=oneline--abbrev-commit
Dbfc0ee Merge bug Fix 119
B4d16ef Bug 119 had fix
8e64728 Merge with No-ff
4F4F23A Dev Commit
F3D8F1E Branch Merge
4BB4C5A Master Branch Merge test
Cccee34 Newbranch First Commit
0D0BBCA Dev First Commit
D5aea29 Master First Commit
023EE21 Initial Commit

For example, to "branch merge" This commit tag, it corresponds to the commit ID is "f3d8f1e", the typing command:

$ git tag v0.9 f3d8f1e

See all the tabs below:

[Email protected] Mingw32/c/gitskill (Master)
$ git tag
v0.9
v1.0

Note: Tags are not listed in chronological order, but are listed alphabetically, and can be viewed with git show tagname:

$ git Show v1.0
Commit dbfc0eebcb89072cf76cdda1eccea37c8b22db73
merge:8e64728 B4d16ef
Author:mars <[email protected]>
Date:tue 24 18:04:26 2016 +0800

Merge bug fix 119

You can also create a label with a description, specify the label name with-A,-m to specify the description text:

[Email protected] Mingw32/c/gitskill (Master)
$ git tag-a v0.1-m "version 0.1 released" Cccee34

[Email protected] Mingw32/c/gitskill (Master)
$ git tag
v0.1
v0.9
v1.0

[Email protected] Mingw32/c/gitskill (Master)
$ git show v0.1
Tag v0.1
Tagger:mars <[email protected]>
Date:tue 24 22:37:10 2016 +0800

Version 0.1 released

Commit cccee3487123b38970e76b95c43269661248c528
Author:mars <[email protected]>
Date:tue 24 15:40:12 2016 +0800

Newbranch First Commit

You can also sign a label with the private key through-s:

$ git tag-s v0.2-m "signed version 0.2 released" 8e64728

Signed with PGP signature, therefore, must first install GPG (GnuPG), if not found GPG, or no GPG key pair, will be error:

[Email protected] Mingw32/c/gitskill (Master)
$ git tag-s v0.2-m "signed version 0.2 released" 8e64728
Gpg:WARNING:using insecure memory!
Gpg:please See http://www.gnupg.org/documentation/faqs.html for more information
Gpg:directory '/C/USERS/LV/.GNUPG ' created
Gpg:new configuration file '/c/users/lv/.gnupg/gpg.conf ' created
Gpg:WARNING:options in '/c/users/lv/.gnupg/gpg.conf ' is not yet active during this run
Gpg:keyring '/C/USERS/LV/.GNUPG/SECRING.GPG ' created
Gpg:keyring '/C/USERS/LV/.GNUPG/PUBRING.GPG ' created
Gpg:skipped "Mars <[email protected]>": Secret Key Not available
Gpg:signing Failed:secret Key Not available
ERROR:GPG failed to sign the data
Error:unable to sign the tag

Generate GPG Key gpg --gen-key 按提示自己生成

To generate a signature label:

$ git tag-u "Mars Lv"-S V0.2-m "signed version 0.2 released" 8e64728

Post-generated signature label:

$ git show v0.2
Tag v0.2
Tagger:mars <[email protected]>
Date:tue 24 23:40:01 2016 +0800

Signed version 0.2 released
-----BEGIN PGP SIGNATURE-----
VERSION:GNUPG v1

Iqicbaabagagbqjxrhxraaojekqd3k/xnfbf/4wp/jy7oclw+74r5vsutvjydoit
T9urpqomte/s3gokphhxo6enpy8hc1yd3keyxsu10u74qdkwh92f62zalszoowvw
Mbjkxglk6sqdsifcnihsnrtbxdg0pyf5ndtjfcizxtmzoej/43uudzkxl+23nnlm
Qfdoopenyzotuagwsmxjtyrkivicod8awb5r1aa71dysv7yefagzkk1chx4bu3tj
A+kprx6d0wwzlz4pj6nrvtvyegtbwactjjy/rr3rhmhognloxdazecdj3jxs1qat
Tkogikp1xwsewrctnanarmpf5najvimzgg8rov2nvrxpu26lknm1fb9yb4/snee1
Clavrj1pxzdiwqeezdb0og3hptrfaaeqwm8re70ib9iei/1iyrv4l+/7lp9ebono
Qniushmxropkxaaqzgknwevmsdwfydmy8m5od8ngmmzozpqhtfegorp+5srwkyg7
Aozsivx1wvzuh+2czojchf7z+zbqynnkb+czxo1gtlonrnkiimnvluiryvrobgog
Exhvcawbr9gajshqdfnkvl8kjykw6m5rjg1je6r+gzqfyrv/krkmjs+p74cuuci0
D/b51ge48zbu6ld8vky5mw0jglwm67a+n79owfmntk+f4ep+ruxyixa2pdfe1zbj
Ou7mtnheknuvqieuyvlo
=4ml3

[Email protected] Mingw32/c/gitskill (Master)
$ git tag-v v0.2
Object 8e647284624ec4ae666bebcdce784aa5db8d39d6
Type commit
Tag v0.2
Tagger Mars <[email protected]> 1464104401 +0800

Signed version 0.2 released
Gpg:WARNING:using insecure memory!
Gpg:please See http://www.gnupg.org/documentation/faqs.html for more information
Gpg:signature made May 24, 2016 23:40:01 using RSA key ID d79c505f
Gpg:good signature from "Mars Lv" (GPG key for Mars) <[email protected]> "

-u, --local-user <key-id> 使用另一个Key签名此tag,“Mars Lv”是我生成的key-id



git tag Management

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.