gpt4 book ai didi

linux - Git fatal error : cannot simplify commit

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:54:40 25 4
gpt4 key购买 nike

我有一个代码库,我已经提交了 2 个月。我每天提交时似乎没有收到任何错误。但是我正在查看 git 日志,我看到第一个 git log(或者 git 可能看不到那个日志点之外)有这样的错误消息

:100755 100755 1948ac6... 2af905e... M  document.doc"
error: Could not read 190d54eb3278746a4e35fd4be82689eb4b1d20a8
fatal: cannot simplify commit cb0c2a3bf0a4ad665eb376b818bdcb0652a06eec (because of 190d54eb3278746a4e35fd4be82689eb4b1d20a8)

我尝试了以下建议:https://git.wiki.kernel.org/index.php/GitFaq#How_to_fix_a_broken_repository.3F

但我没有得到我想要达到的目标,无论推荐什么都对我的情况没有帮助。

最佳答案

此解决方案可以帮助您:

备份你的 .git 目录,以防你在这个过程中破坏更多东西。然后,放回可用的最佳版本的包文件。

对于每个损坏的包文件,运行:

mv .git/objects/pack/pack-**yourpack**.pack oldpack
git-unpack-objects -r < oldpack
Run git fsck --full and git checkout again, give us the output.

看起来现在您应该可以 checkout 了,但是您必须运行 git checkout -f yourbranch,因为您的工作目录中有尚未提交的更改。但是,当您运行 git checkout -f 时,这些更改将会丢失。

备注:This solution was sugested by @Chronial

关于linux - Git fatal error : cannot simplify commit,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27236894/

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