修复损坏的git存储库 [英] Repair corrupted git repository
问题描述
由于电源问题,我的git存储库在几次硬重启后损坏了,现在我无法修复它(我在最后一次电源故障时正在暂存一些文件)
$ git status
致命:无法读取对象3d18855708b0f127d40c13c679559d7679228b69:无效参数
$ git fsck
致命:未能读取对象24377c609184c192f3f3c1733bac7115c1080758:无效参数
$ git分支-a
(...作品,列表分支...)
$ git checkout someotherbranch
致命:无法读取对象3d18855708b0f127d40c13c679559d7679228b69 :无效的参数
$ git log
致命:无法读取对象3d18855708b0f127d40c13c679559d7679228b69:无效参数
$ git log someotherbranch
(... works,shows commitits ...)
所以,正如你所看到的,我目前的分支非常糟糕,我似乎无法修复它。任何ideea我可以尝试修复这个问题?
对于类似情况,我的解决方案是替换 My git repository got corrupted after a couple of hard reboots due to power supply issues and now I'm unable to fix it (I was in the middle of staging some files at the last power failure) So, as you can see, my current branch is pretty screwed up and I don't seem to be able to fix it. Any ideea what can I try to repair this? My solution for a similar situation was to replace a hash of the damaged object in 这篇关于修复损坏的git存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! .git / (可以在
.git / logs / HEAD
中找到)。 / p> $ git status
fatal: failed to read object 3d18855708b0f127d40c13c679559d7679228b69: Invalid argument
$ git fsck
fatal: failed to read object 24377c609184c192f3f3c1733bac7115c1080758: Invalid argument
$ git branch -a
(...works, lists branches...)
$ git checkout someotherbranch
fatal: failed to read object 3d18855708b0f127d40c13c679559d7679228b69: Invalid argument
$ git log
fatal: failed to read object 3d18855708b0f127d40c13c679559d7679228b69: Invalid argument
$ git log someotherbranch
(...works, shows commits...)
.git/refs/heads/my-working-branch
with a hash of previous commit (which can be found in .git/logs/HEAD
).