轻量tag(lightweight tags)

git tag <tagname>

 

注解tag(Annotated Tags)

git tag -a v1.4

git tag -a v1.4 -m "this is my version 1.4"

 

展示tags(Listing Tags)

git tag

git tag -l *-rc*   // -l option can be passed with a wild card expression

 

为旧Commit打tag

1.git log得到commit xxxxxx

2.git tag -a v1.2 xxxxxx

 

重新打tag

git tag -a -f v1.4 xxxxx (必须要加-f)

 

推送到远程

git push origin v1.4

 

Checking Out Tags

git checkout v1.4

The above command will checkout the ​​v1.4​​​ tag. This puts the repo in a detached ​​HEAD​​​ state. This means any changes made will not update the tag. They will create a new detached commit. This new detached commit will not be part of any branch and will only be reachable directly by the commits SHA hash. Therefore it is a best practice to create a new branch anytime you're making changes in a detached ​​HEAD​​ state.

 

删除tags

git tag -d v1

 

 

资料1:https://www.atlassian.com/git/tutorials/inspecting-a-repository/git-tag