git branch -d< BRANCH>:致命 - 无法查找HEAD的提交对象 [英] git branch -d <BRANCH>: Fatal - Couldn't look up commit object for HEAD

查看:1878
本文介绍了git branch -d< BRANCH>:致命 - 无法查找HEAD的提交对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我在一个裸仓库(远程)中,如果我尝试用 git branch -d > 删除一个分支,我得到以下错误:

 致命:无法查找HEAD 
的提交对象

为什么?是否有原因导致我无法从裸仓库删除分支?

确保你使用的是国会大厦 D ,在这种情况下,您可以输入 git branch -D > 。请注意,这只会从本地计算机中删除分支



如果您要删除远程分支,请键入 git push origin:< branch_name> (记得添加冒号)


Say I am in a bare repository (a remote), if I try to delete a branch with git branch -d <branch_name> I get the following error:

fatal: Couldn't look up commit object for HEAD

Why? Is there a reason why I should be unable to delete branches from a bare repository?

解决方案

Make sure you use a capitol D in the command, in this case you would type git branch -D <branch_name>. Note that this will only delete the branch from your local computer

If you are trying to delete a remote branch, type git push origin :<branch_name> (remember to add the colon)

这篇关于git branch -d&lt; BRANCH&gt;:致命 - 无法查找HEAD的提交对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆