检查推送的标签是否在 git 遥控器上
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6294224/
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
check if pushed tag is on the git remote
提问by lcb
Anyone know how to check if a tag is on the git remote after the tag is pushed from the local?
有谁知道从本地推送标签后如何检查标签是否在 git remote 上?
It seems that the only way to do it is to fetch the remote.
似乎唯一的方法是获取遥控器。
回答by Abe Voelker
Try
尝试
git ls-remote --tags origin
回答by Diego
To more precisely answer this question, to check if a specific tagis in a given remoteuse:
要更准确地回答这个问题,请检查特定标签是否在给定的远程使用中:
git ls-remote <remote-name> refs/tags/<tag-name>
回答by HMagdy
For lazy people like me, I used to search for it like this:
对于像我这样的懒人,我以前是这样搜索的:
On remote tags:
在远程标签上:
git ls-remote --tags origin | grep TAG_NAME
On local tags.
在本地标签上。
git tag -l | grep TAG_NAME
回答by Axial
In reply to lcb's question in the comments section:
在评论区回复lcb的问题:
I got these results: refs/tags/0.1, refs/tags/0.1^{}. Do you know what is the second one?
我得到了这些结果:refs/tags/0.1、refs/tags/0.1^{}。你知道第二个是什么吗?
See Git tag, Why this duplicate tag in remotes?for a detailed answer.
请参阅Git 标签,为什么在遥控器中有这个重复的标签?求详细解答。
回答by dgo.a
Another way, (from "git: check if commit xyz in remote repo?")
另一种方式,(来自“ git: check if commit xyz in remote repo?”)
git branch -r --contains my_tag
# ==== or with a sha1: =====
git branch -r --contains 2e29022d
This will list the remote branches that contain the tag or commit.
这将列出包含标记或提交的远程分支。
The output will look like:
输出将如下所示:
origin/my_branch_1
origin/my_other_branch
origin/master