How to fix GIT error : HEAD: invalid reflog entry xxxxxxxxxxxxxxxx

感情迁移 提交于 2019-12-07 05:19:32

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!