git 如何仅将特定标签推送到远程?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23212452/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to only push a specific tag to remote?
提问by Yad Smood
Is there a command like git push --tag tag_a
? I only found git push --tags
.
有类似的命令git push --tag tag_a
吗?我只发现git push --tags
.
回答by Pavel ?imerda
You can simply use:
您可以简单地使用:
git push origin tag_a
Alternatively (mainly to solve tag/branch name clashes), you could use:
或者(主要是为了解决标签/分支名称冲突),您可以使用:
git push origin refs/tags/tag_a
回答by Yad Smood
As pointed out by Pavel ?imerda, you can simply do
正如Pavel ?imerda所指出的,你可以简单地做
git push <remote> <tag>
I've added the specification for a remote <remote>
so that the command doesn't depend on a user's push.default
configuration.
我添加了遥控器的规范,<remote>
以便命令不依赖于用户的push.default
配置。
Here is a summary of the relevant documentationthat explains how to push a specific tag:
以下是解释如何推送特定标签的相关文档的摘要:
git push [[<repository> [<refspec>…]] <refspec>...
The format of a
<refspec>
parameter is…the source ref<src>
, followed by a colon:
, followed by the destination ref<dst>
…The
<dst>
tells which ref on the remote side is updated with this push…If:<dst>
is omitted, the same ref as<src>
will be updated…tag
<tag>
means the same asrefs/tags/<tag>:refs/tags/<tag>
.
git push [[<repository> [<refspec>…]] <refspec>...
<refspec>
参数的格式是……源引用<src>
,后跟冒号:
,后跟目标引用<dst>
……在
<dst>
该裁判在远程端与此更新推...讲述如果:<dst>
省略,同样的裁判作为<src>
将被更新...标签的
<tag>
含义与refs/tags/<tag>:refs/tags/<tag>
.