How can I recover a git stash operation that doesn't have a tree root?

Viewed 81

I had a strange problem this morning. I had a working directory and attempted to commit some changes. During the commit (I have no idea how), my system froze and required a reboot. As a result, somehow the git tree became corrupted.

Normally, this wouldn't be much of an issue, but I couldn't really do anything in the tree because there were 0-size objects. After removing them from the .git directory, I was able to git stash save my local changes. However, now when I try to git stash pop, I receive the following error:

fatal: unable to read tree 315bb2f5556d4a330abb7a1bdc26cfabf927d783

Basically, what it seems to be telling me is that it can't find the commit from which to generate the diff for the file in question. Ideally, I'd like to restore this stash so I can pop it and commit my work, but, barring this, is it possible to see the state of files absolutely from this stash (i.e. see the state of text files in my source directory and recreate the changes in my working directory from a "known good" state by hand).

I've tried running git fsck, but it complains about a series of dangling refs and doesn't actually do anything to the repo in question to fix any problem(s). I'm not quite sure what else to try, as the internals of git are a bit of a black box to me.

UPDATE:

I did now notice this in the output of git fsck:

broken link from    tree 946ebd49a429a1f9e0f48ba7af56ef680287635e
              to    tree 315bb2f5556d4a330abb7a1bdc26cfabf927d783

This is the only broken link type of message in the output, but I am not sure what it means.

0 Answers
Related