简体   繁体   中英

Git fatal: cannot simplify commit

I have a repo that I have been committing for 2 months. 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

: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

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. Then, put back the best version of the packfiles you have available.

For each of the corrupt packfiles, run:

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. These changes will get lost when you run git checkout -f, though.

Note: This solution was sugested by @Chronial

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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