当我
git branch -a | grep my_funny_branch
它给出了
remotes/origin/my_funny_branch
但是当我
git branch -d -r origin/my_funny_branch
它给出了
error: remote branch 'origin/my_funny_branch' not found
当我只是
git pull origin master
我得到了
git pull origin master
From ssh://example.com/foo/bar
* branch master -> FETCH_HEAD
Auto packing the repository for optimum performance. You may also
run "git gc" manually. See "git help gc" for more information.
error: bad ref for refs/remotes/origin/my_funny_branch
error: bad ref for refs/remotes/origin/my_funny_branch
Counting objects: 47339, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (16489/16489), done.
Writing objects: 100% (47339/47339), done.
Total 47339 (delta 30622), reused 47339 (delta 30622)
Rename from '.git/objects/pack/.tmp-7576-pack-15e7c5d209199f384b04dd820a8d625c658f7402.pack' to '.git/objects/pack/pack-15e7c5d209199f384b04dd820a8d625c658f7402.pack' failed. Should I try again? (y/n)
如何删除该远程分支?
谢谢!
答案 0 :(得分:13)
此错误消息很有趣:
error: bad ref for refs/remotes/origin/my_funny_branch
查看Git源代码,当Git处理该ref的reflog时会出现该消息。日志可能会以某种方式被破坏,从而阻止ref上的各种操作成功完成。
备份后,尝试删除该参考的日志:
rm -rf .git/logs/refs/remotes/origin/my_funny_branch
然后看看你是否可以删除分支。
答案 1 :(得分:3)
尝试投放git remote prune origin
或git fetch origin --prune
答案 2 :(得分:2)
git update-ref -d refs/remotes/origin/my_funny_branch
如果这不起作用,我会在你的.git目录中寻找'my_funny_branch'(可能是.git / refs / remotes / origin),看看是否有文件权限的傻瓜。
答案 3 :(得分:1)
你试过这个吗?
git push origin :my_funny_branch
答案 4 :(得分:1)
我有这个确切的问题。 对我来说解决方法如下:
var c= using db in db.c where c.id==id
然后
git remote prune origin
最终将大约20个幽灵分支的列表缩减为实际上是一个实时分支