How to diagnose and fix git fatal: unable to read tree

前端 未结 5 923
误落风尘
误落风尘 2020-11-30 03:06

I\'m using git to manage files on a project, and keep running into this problem.

When I run git status I get the message

fa         


        
5条回答
  •  不知归路
    2020-11-30 03:34

    Something that just worked for me was stashing my changes, doing a git pull, and then popping the changes back off the stash stack. My corruption might of been pretty shallow, so it probably won't work for everyone but it's worth a try.

    Here's the output I got when I stashed:

    work@home ~/code/project $ git stash
    fatal: unable to read tree 5fd5f4d0425b42e5b478773fa643dd6fd4918188
    fatal: unable to read tree 5fd5f4d0425b42e5b478773fa643dd6fd4918188
    Saved working directory and index state WIP on master: d93430c Generic commit msg.
    HEAD is now at d93430c An older generic message.
    

    After that I pulled and then popped and it cleaned itself up. Again, YMMV.

提交回复
热议问题