Git Common Commands - Tag

show all tags
$ git tag
v0.1-alpha
v0.1.1-alpha
v2.0.0.1000-release

Show eligible tags
$ git tag -l 'v0.1*'
v0.1-alpha
v0.1.1-alpha

Create a new label locally
$ git tag -a v2.0.0.1000-release -m 'Release Version 2.0.0 Version Code 1000'
Description:
-a (annotated) Create a label with annotation type
-m Add label description
Note : After the new label is named, the label at this time is not uploaded to the remote server. The "Share Tag" operation is required to upload to the remote server.

You can also create a lightweight tag (actually a file that holds the checksum information of the corresponding submitted object) by specifying only the tag name without the -a and -m parameters:
$ git tag v2.0.0.1000-release

View the specified label version information and submission information
$ git show v0.1-alpha
tag v0.1-alpha
Tagger: yhz61010 <[email protected]>
Date:   Fri Aug 18 10:45:09 2017 +0800

vitamio mediaplayer version

commit bfr82ae576f208a234a3671a98baafeyg659fs2
Author: yhz61010 <[email protected]>
Date: Mon Aug 14 09:47:24 2017 +0800
...

Sharing tags
By default, git push does not upload tags to the remote server. You must pass the push command to share tags to the remote repository.
Upload all tags added locally to the remote server
$ git push origin --tags
Username for '<your git url>': <your git username>
Password for '<your password>':
Object count: 1, done.
Write to object: 100% (1/1), 187 bytes | 0 bytes/s, done.
Total 1 (delta 0), reused 0 (delta 0)
To <your git url>
 * [new tag]         v2.0.0.1000-release -> v2.0.0.1000-release

Upload the specified tag to the remote server
$ git push origin v1.5

Delete local tags
$ git tag -d v1.0
Removed tag 'v1.0' (was fd0a4a0)

delete remote tag
$ git push origin :refs/tags/v1.0
Username for 'url': <your user name>
Password for 'url': <your password>
To <git url>
 - [deleted]         v1.0

References:
https://git-scm.com/book/en/v1/Git-%E5%9F%BA%E7%A1%80-%E6%89%93%E6%A0%87%E7%AD %BE

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326218102&siteId=291194637