紀錄一些比較冷門的 git tag
指令.
Git tag 分為兩大類: annotated tag 和 lightweight tag.
Leighweight tag 和 branch 概念類似, 都是一個指向某個 commit object 的 pointer
$ git tag TAG_NAME [COMMIT-ISH]
Annotated tag 和 commit/tree/blob 一樣, 為 git 的基礎物件之一. 除了指向某個 commit 物件外, 也包含了 tagging message 等資訊.
$ git tag -a TAG_NAME [COMMIT-ISH]
要分辨一個 tag 是 annotated 或是 lightweight, 可輸入以下指令.
若有出現 ^{}
dereference operator, 就是 annotated tags.
$ git show-ref -d --tags [TAG_NAME]
$ git tag -d TAG_NAME
和 remote git repos 操作.
$ git push REMOTE TAG_NAME
簡單的刪除命令如下.
$ git push --delete origin TAG_NAME
也可以 push 一個 empty reference 到 remote.
$ git push origin :TAG_NAME
Git
Written on
March
2nd
,
2021
by
Borting