1. 程式人生 > >git操作總結(4):標籤操作

git操作總結(4):標籤操作

1.命令git tag用於本地新建一個標籤

(1)預設針對HEAD

給HEAD打下v1.1的標籤

git tag v1.1

(2)給指定版本打標籤

-》首先,檢視歷史

git log --pretty=oneline --abbrev-commit

-》然後,針對id給標籤

git tag v0.9 6224937

其中:6224937是指定版本的id

(3)建立標籤,並且備註

git tag -a v0.1 -m "version 0.1 released" 3628164

其中:3628164是指定版本的id,可以不寫

2.檢視標籤資訊

git show v1.1
或者
git tag   //可以檢視所有標籤。

3.刪除標籤

(1)本地標籤

git tag -d v0.1

(2)刪除遠端標籤    -》先從本地刪除

git tag -d v0.9

   -》從遠端刪除

git push origin :refs/tags/v0.9

4.本地標籤推送到遠端

(1)推送一個指定標籤

git push origin v1.1

(2)推送全部未推送的本地標籤

git push origin --tags