Git 推送和删除远程标签

我打标签这习惯是从SVN 遗传来的。。。


推送

1
git push origin 标签名

删除

1
git push origin :refs/tags/标签名

事实上Git 的推送和删除远程标签命令是相同的。删除操作实际上就是推送空的源标签 refs.
git push origin 标签名
相当于
git push origin refs/tags/源标签名:refs/tags/目的标签名
git push 文档中有解释:

tag <<tag>> means the same as refs/tags/<tag>:refs/tags/<tag>.
Pushing an empty <src> allows you to delete the <dst> ref from the remote repository.

其它本地操作:

1
2
3
4
5
6
#打标签
git tag -a v1.1.4 -m "tagging version 1.1.4"
#删除本地仓库标签
git tag -d v1.1.4
#列出标签
git tag

参考文档:
http://nathanhoad.net/how-to-delete-a-remote-git-tag
http://linux.die.net/man/1/git-push

更多
No Responses Post a comment

Leave a Reply

Note: You may use basic HTML in your comments. Your email address will not be published.

Subscribe to this comment feed via RSS