Windows 蓝屏后恢复 git 存储库?

tyo*_*213 1 git recovery blue-screen-of-death

我刚刚遇到蓝屏,我将上周左右的所有工作都存储在其中,但现在在那次事件之后它就消失了......好吧,我可以.git在资源管理器中看到该文件夹​​,但这样做git status or fsck表明它不是一个git repo...这是 powershell 上的一个小玩意

PS C:\Users\tyoc\Documentos\wtf> git status fatal: Not a git repository (or any of the parent directories): .git PS C:\Users\tyoc\Documentos\wtf> cd .git PS C:\Users\tyoc\Documentos\wtf\.git> git status fatal: Not a git repository (or any of the parent directories): .git PS C:\Users\tyoc\Documentos\wtf\.git> cd .. PS C:\Users\tyoc\Documentos\wtf> git init Reinitialized existing Git repository in C:/Users/tyoc/Documentos/wtf/.git/ PS C:\Users\tyoc\Documentos\wtf> git status fatal: Not a git repository (or any of the parent directories): .git PS C:\Users\tyoc\Documentos\wtf> git fsck --no-reflog fatal: Not a git repository (or any of the parent directories): .git PS C:\Users\tyoc\Documentos\wtf> git stash fatal: Not a git repository (or any of the parent directories): .git

能拿回藏匿的东西真是太好了,因为幸运的是,回购协议有一个中央存储库,所以那里一切都很好......但我的工作不是,如果我一周没有做任何事情会怎么样......:S 。


我添加此内容是为了澄清:

蓝屏之前的仓库状态是我的工作在存储中(我有大约 7 个旧存储,最后一个是我本周的工作),因为我的客户要求我修改一些内容(所以我存储了我正在做的事情)做了更改并推送...在我恢复存储之前几秒钟我得到了蓝屏,然后在 reebot 之后,我无法执行任何 git 命令,即使 .git 目录在那里... (我不知道它是否包含某些东西或只是结构)。

因此,文件的状态是一个干净的工作副本(因为目前请求的更改),而我的实际工作是/在存储中......

好吧,我使用 sourcetree 作为前端...不知道是 sourcetree 的错误还是一天结束时的蓝屏..但问题是我在储藏室中失去了工作...

Pau*_*ros 5

蓝屏之后我的 git 存储库显然已损坏,就发生在我这边。我注意到文件 .git/HEAD 是空的。我通过将以下内容添加到 .git/HEAD 解决了该问题:

ref: refs/heads/master
Run Code Online (Sandbox Code Playgroud)