本文介绍了在git中删除损坏的分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我用git checkout -b mybranch创建了分支。似乎出现了一些问题,现在我无法使用git branch -D mybranch将其删除。它说:error:branch'mybranch'not found。
解决方案如果 code>真的不起作用,那么你唯一的选择就是对它进行旁观并自己编辑git check-out的状态。你应该到你的退房的根目录( .git 目录)和
- 编辑 .git / packed-refs ;如果您看到有分行名称的行,请将其删除,以查找名为您的分行名称的文件
- 查看 .git / refs / heads 科;如果看到一个,请将其删除
I have created branch with "git checkout -b mybranch". It seems that something went wrong, and now I can't delete it using "git branch -D mybranch". It says: error: branch 'mybranch' not found.
解决方案
If git branch -D really isn't working, then your only option is to side-step it and edit the git check-out's state yourself. You should go to the root-directory of your check-out (where the .git directory is) and
- edit .git/packed-refs; if you see a line with your branch name then delete it
- look in .git/refs/heads for a file named after your branch; if you see one, delete it
这篇关于在git中删除损坏的分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-04 20:05