简体   繁体   English

Git致命:无法简化提交

[英]Git fatal: cannot simplify commit

I have a repo that I have been committing for 2 months. 我有一个已经执行了2个月的仓库。 I do not seem to get any error when I commit daily. 每天提交时,我似乎都没有收到任何错误。 However I was looking at git logs and I see that first ever git log (or maybe git can't see beyond that log point) has an error message like this 但是我正在查看git日志,我看到有史以来第一个git日志(或者git看不到该日志点之外)都有这样的错误消息

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

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

But I did not get what I was trying to achieve, whatever was recommended did not help my case. 但是我没有得到我想要达到的目标,无论如何推荐都无济于事。

This solution could help you: 该解决方案可以帮助您:

Make a backup of your .git directory in case you corrupt things more in this process. 备份.git目录,以防您在此过程中损坏更多内容。 Then, put back the best version of the packfiles you have available. 然后,放回可用的最佳Packfile版本。

For each of the corrupt packfiles, run: 对于每个损坏的packfile,运行:

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.

Looks like now you should be able to check out, but you will have to run git checkout -f yourbranch , as you have changes in your working dir that are not yet committed. 看起来现在您应该可以签出,但是您将不得不运行git checkout -f yourbranch ,因为您的工作目录中有尚未提交的更改。 These changes will get lost when you run git checkout -f, though. 但是,当您运行git checkout -f时,这些更改将丢失。

Note: This solution was sugested by @Chronial 注意: 此解决方案由@Chronial推荐

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM