gpt4 book ai didi

计算机死机后 Git 存储库损坏

转载 作者:IT王子 更新时间:2023-10-29 01:25:49 28 4
gpt4 key购买 nike

我的电脑死机了,现在我的一个 git 存储库坏了。当我尝试 checkout master 时,它告诉我:

warning: ignoring broken ref refs/heads/master.
error: Your local changes to the following files would be overwritten by checkout:
com.vainolo.jdraw2d.releng.p2/pom.xml
Please, commit your changes or stash them before you can switch branches.
Aborting

当我执行 git stash 时,我得到:

fatal: bad revision 'HEAD'
fatal: bad revision 'HEAD'
fatal: Needed a single revision
You do not have the initial commit yet

那么...我能做什么?

更新git reflog 的输出:

fatal: bad default revision 'HEAD'

不太有前途... git fsck 的输出:

error: Invalid HEAD
Checking object directories: 100% (256/256), done.
error: unable to unpack 59551f96b4e87a1c14293c19eb548ce6fa1f196f header
error: inflateEnd: stream consistency error (no message)
fatal: loose object 59551f96b4e87a1c14293c19eb548ce6fa1f196f (stored in .git/objects/59/551f96b4e87a1c14293c19eb548ce6fa1f196f) is corrupt

最佳答案

我通过以下方法恢复了:

rm .git/refs/remotes/origin/HEAD
git fetch --all

关于计算机死机后 Git 存储库损坏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15317072/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com