[英]Removing Branches from GitHub
大约3周前,我从本地存储库中删除了一些分支,但从未从GitHub上的存储库中删除它们。 我需要清理其中一些分支,但未成功。
例如,我在3周前从本地删除了该分支: 1234e-proj
现在,我正在尝试运行:
git push origin :1234e-proj
我得到这个错误:
error: unable to push to unqualified destination: 1234e-proj
The destination refspec neither matches an existing ref on the remote nor
begins with refs/, and we are unable to guess a prefix based on the source ref.
error: failed to push some refs to
知道我在做什么错吗? 我已经在本地删除了几个分支,这种情况正在发生。
您是否尝试使用
git push --delete origin '1234e-proj'
要么
git push --mirror origin # warning: pushes all refs and deletes all others!
否则,它应该工作。 也许您可以共享一个
git branch -a
首先,一个大胆的猜测:这些分支实际上仍在GitHub存储库中,在网络上可见吗?还是您只是将它们视为存储库中的远程分支? (运行git remote update --prune
来更新内容;如果它们仅在您的本地存储库中,则会对其进行修剪。)
使用git ls-remote origin
在远程站点上看到引用时,在远程站点上打印引用,例如:
406da7803217998ff6bf5dc69c55b1613556c2f4 HEAD
1e501a7c47ad5ada53d3b1acfb9f131f76e969ec refs/heads/maint
406da7803217998ff6bf5dc69c55b1613556c2f4 refs/heads/master
56e79320f3d9b044c380dfebf136584aaa17ac5b refs/heads/next
...
找到要删除的对象,然后使用git push :<ref>
进行删除,例如git push :refs/heads/branch-foo
。
我不确定要怎么做,但是如果ref确实存在于遥控器上,这应该是查看和删除它们的简便方法。 我最好的猜测是,您在GitHub上看到的refs实际上不在refs/heads
,因此使用不合格的refname无效。 (不过,我不确定您在这种情况下会如何发展!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.