问题
I have met an error before(GIT error: object file is empty)
Then I used the method mentioned in how to fix GIT error: object file is empty?
After I updated the HEAD pointer to a good object, it does work .but when I restart the machine ,the same error(object file is empty) occured.
I tried find . -type f -empty -delete to delete all the empty files and type git fsck --full then the new error occured.(GIT error: HEAD: invalid reflog entry xxxxxxxxxxxxxxxx)
Is there anything wrong with my GIT? or just because of my bad operations? And how to fix this problem?
回答1:
The command to use is git reflog expire --stale-fix --all
The magic here is in the --stale-fix option which will prune any reflog entries that point to an unreachable commit and that refers to a missing object.
来源:https://stackoverflow.com/questions/39409252/how-to-fix-git-error-head-invalid-reflog-entry-xxxxxxxxxxxxxxxx