对不起,模糊的标题。如果任何人都可以想出更好的东西,请编辑这个让我知道。修复损坏的git存储库。没有默认版本'HEAD'
最近,我删除了一个git存储库,并从服务器中检出了一个新副本。不幸的是,当这样做时,我忘记了我正在使用git-new-workdir
(我认为我已经复制了我的回购两次)。现在,我不能在我的“WORKDIR”做任何事情:
$ git log
fatal: bad default revision 'HEAD'
和git status
给比它应该的方式更多的变化。有没有人对我如何解决这个问题有任何想法?
更多信息:
运行git fsck
给了我下面的:
$ git fsck
notice: HEAD points to an unborn branch (dipole_fix)
missing blob d92f4a4f53c95c375146d9623910d8ec214aa02f
missing blob 7d81095605082af3252a47b47d81e48d4a78a668
missing blob f5d21b7785c4bca4efaa91ce5ef5a8bd82d98792
missing blob 79d3ad61db697ca7e89dbfd089a472dab0a7851b
missing blob 2cf0e64cbc0a816d7dc1b26fef43c2eb7c4fb6ac
对于它的价值,我确实有它的dipole_fix
分支远程分支。它应该是(相对)最新的。
更新1 - 查看工作目录中.git
的内容,看起来我有几个悬挂的符号链接。
lrwxrwxrwx 1 mgilson mgilson 39 2012-04-26 10:43 remotes -> /orig_repo/.git/remotes
lrwxrwxrwx 1 mgilson mgilson 40 2012-04-26 10:43 rr-cache -> /orig_repo/.git/rr-cache
lrwxrwxrwx 1 mgilson mgilson 35 2012-04-26 10:43 svn -> /orig_repo/.git/svn
更新2 - Naievly联remotes
到/orig_repo/refs/remotes
似乎摆脱 “坏头” 的问题,但现在git status
给我:
error: unable to find d92f4a4f53c95c375146d9623910d8ec214aa02f
error: unable to find d92f4a4f53c95c375146d9623910d8ec214aa02f
error: unable to find f5d21b7785c4bca4efaa91ce5ef5a8bd82d98792
error: unable to find f5d21b7785c4bca4efaa91ce5ef5a8bd82d98792
error: unable to find 79d3ad61db697ca7e89dbfd089a472dab0a7851b
error: unable to find 79d3ad61db697ca7e89dbfd089a472dab0a7851b