有像 git push --tag tag_a这样的命令吗? 我只找到了 git push --tags。
git push --tag tag_a
git push --tags
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
As pointed out by Pavel Šimerda, you can simply do
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 documentation that 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 as refs/tags/<tag>:refs/tags/<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>…
<refspec>
<src>
:
<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…
:<dst>
tag <tag> means the same as refs/tags/<tag>:refs/tags/<tag>.
<tag>
refs/tags/<tag>:refs/tags/<tag>