在提交期间丢失电源后,我的git存储库中的一个分支被破坏了。我做了git fsck --full,删除了所有的空对象文件,直到fsck给了我:
Checking object directories: 100% (256/256), done.
Checking objects: 100% (894584/894584), done.
error: refs/heads/git-annex does not point to a valid object!
Checking connectivity: 862549, done.然后,我使用git fsck --lost-found在git-annex分支上找到了最后一个好的悬空提交。我查过了。
我想让这个做我的git-annex代言人。我试过git checkout -b git-annex,但知道分支已经存在了。所以我尝试了git branch -d git-annex,但得到了error: Couldn't look up commit object for 'refs/heads/git-annex'。
为了将其设置为我想要的提交,我如何处理坏掉的git-annex分支?我已经尝试过只删除.git/refs/heads/git-annex,但这不起作用。谢谢。
发布于 2013-08-26 15:16:41
这适用于我(在“欺骗”之后插入一个损坏的分支,并在尝试删除它时看到相同的错误):
git branch -f broked HEAD # or some other valid point
git branch -d broked第二个命令会发出牢骚,因为它会从.git/packed中删除坏掉的引用(如果删除.git/ ref /head/git-附件没有帮助的话,这就是我假设的情况)。(但分支名“git-附件”使我怀疑您是否使用git-附件,就像在回购之外存储大型文件的东西一样。我自己没有用过,也不确定这是否有什么改变。)
https://stackoverflow.com/questions/18447293
复制相似问题