Git 分享标签

默认情况下,git push 并不会把标签传送到远端服务器上,只有通过显式命令才能分享标签到远端仓库。其命令格式如同推送分支,运行 git push origin [tagname] 即可:

[code]$ git push origin v1.5
Counting objects: 50, done.
Compressing objects: 100% (38/38), done.
Writing objects: 100% (44/44), 4.56 KiB, done.
Total 44 (delta 18), reused 8 (delta 1)
To [email protected]:schacon/simplegit.git

  • [new tag] v1.5 → v1.5[/code]

如果要一次推送所有本地新增的标签上去,可以使用 --tags 选项:

[code]$ git push origin --tags
Counting objects: 50, done.
Compressing objects: 100% (38/38), done.
Writing objects: 100% (44/44), 4.56 KiB, done.
Total 44 (delta 18), reused 8 (delta 1)
To [email protected]:schacon/simplegit.git

  • [new tag] v0.1 → v0.1
  • [new tag] v1.2 → v1.2
  • [new tag] v1.4 → v1.4
  • [new tag] v1.4-lw → v1.4-lw
  • [new tag] v1.5 → v1.5[/code]

现在,其他人克隆共享仓库或拉取数据同步后,也会看到这些标签。

REF:[url]http://cwiki.ossez.com/pages/viewpage.action?pageId=7045482[/url]