我不知道是怎么回事,但当我运行git ls-remote
命令时,我们的远程代码库出现了以下这种命名的分支和标签:
refs/heads/abc^{}
refs/tags/def^{}
我似乎无法以常规方式删除它们:
git push origin :refs/heads/abc^{}
fatal: remote part of refspec is not a valid name in :refs/heads/abc^{}
我该如何删除这些格式不正确的远程分支?
我不知道是怎么回事,但当我运行git ls-remote
命令时,我们的远程代码库出现了以下这种命名的分支和标签:
refs/heads/abc^{}
refs/tags/def^{}
我似乎无法以常规方式删除它们:
git push origin :refs/heads/abc^{}
fatal: remote part of refspec is not a valid name in :refs/heads/abc^{}
那不是一个分支,而是一次不良分支的结果:
server$ echo echo 2e79bc84c11eda5d73add5a9dfc6bf03c50c432d > refs/heads/oogly
echo
)制作破损分支。client$ git ls-remote
[snip]
d1574b852963482d4b482992ad6343691082412f refs/heads/master
2e79bc84c11eda5d73add5a9dfc6bf03c50c432d refs/heads/oogly
676699a0e0cdfd97521f3524c763222f1c30a094 refs/heads/oogly^{}
[snip]
oogly
,在您的情况下为abc
)将使“去皮标签”也在客户端消失。请注意,如果您想保存标签,则应该指向一个标签,如果还没有标签。
我不知道这是如何在服务器上创建的。
请注意,这对于(带注释的)标签来说是完全正常的:服务器同时提供标签及其SHA-1和指向其所指向的底层对象的SHA-1。语法在gitrevisions中有文档记录:
<rev>^{}, e.g. v0.99.8^{}
A suffix ^ followed by an empty brace pair means the object could
be a tag, and dereference the tag recursively until a non-tag
object is found.
git push origin :abc^{}
吗?你正在使用哪个服务? - isherwood