在提交期间断电后,我的 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
HEAD。我试过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
,但这不起作用。谢谢。