是否可以列出具有特定模式的带注释标签,而无需从 Git 克隆或拉取整个存储库?
我想做的基本上是这样的:
git tag -l "*pattern*" | sort -r
Run Code Online (Sandbox Code Playgroud)
无需克隆存储库。
我知道您可以用来ls-remote列出标签,即
git ls-remote --tags git://github.com/git/git.git
Run Code Online (Sandbox Code Playgroud)
但这似乎并没有给我提供搜索的选项*pattern*(如果我没记错的话)。
有没有办法做到这一点?
对的,这是可能的。可以用来git ls-remote <remote> --tags <pattern>搭配。
例如:
git ls-remote <remote> --tags **/v*.0
e8b29c3c46a59dc59e2a3b22c253860c23a9ea39 refs/tags/v1.0.0
与
git ls-remote <remote> --tags **/v*.10
在标签refs/tags/v1.0.0存在的存储库中。
您可以查看ls-remote 文档