我移动了一堆文件和目录(包括我的.git目录),然后又移回来,现在git坏了
这是我得到的错误消息:
fatal: Not a git repository (or any of the parent directories): .git
显然,根据I backed up a git project, and got "fatal: Not a Git Repository"的说法,解决方案是将head重命名为HEAD
我的问题是现在我只有ORIG_HEAD而没有head。我能不能把ORIG_HEAD重命名为HEAD,然后把我的git repo改回来?(很抱歉我的双关语,我不得不这样)
发布于 2011-06-21 16:23:32
试试git reflog,看看它是否仍然知道你正确的“最后”头像,很可能它已经知道了:
git log HEAD@{0}或
git log HEAD@{1}如果你想回到那里,
git checkout -b rescue HEAD@{0} # or whatever head it was来创建一个救援分支。如果您确定它是正确的版本(并且您没有任何想要保留的未提交更改):
git reset --hard HEAD@{0} # or whatever head it washttps://stackoverflow.com/questions/6420672
复制相似问题