在 Git 中,我创建了一些本地标签,并且只有其中一些我想推送到源。
一段时间后,我想检查一下推送到远程时遗漏了哪些标签。
我们是否有命令显示所有在本地仓库中但尚未推送到远程仓库的标签?
谢谢。
最佳答案
考虑一个 git push
can also push tags ,您可以使用 git push --dry-run
来预览推送并查看标签是否被推送。
git push --tags --dry-run
这将列出远程不存在的本地标签。
如果输出为空,则所有标签都已推送。
请注意,如“How can I see what I am about to push with git?”中所述:
The problem with
git push --dry-run
is that it still requires write permission at the remote.
So if you have a clone without permission to push upstream, but you'd like to see what your local unpushed changes are,--dry-run
won't do it.
在那种情况下,knittl提到的脚本解决方案在 the comments (git ls-remote --tags origin
vs. git tag
)是另一种选择。
关于git 标签还没有推送到远程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30611831/