Lost a git commit

190 Views Asked by At

I have the hash for a git commit I made a few weeks ago. I tried checking it out but it says that the hash "did not match any file(s) known to git". I also looked for it in git reflog, but don't see it there. I don't see the earliest commits I made in reflog either.

I couldn't find the missing commit in my remote repository in Gitorious either. However, I do see the earliest commits I made in Gitorious, just not the one I'm looking for.

1

There are 1 best solutions below

2
On BEST ANSWER

Well, the commit no longer exists in your database, which is unfortunate. Start with a git lost-found just in case you have the hash wrong.

If it disappeared because it was garbage collected, you're out of luck. If it disappeared for any other reason (disk corruption, file system bug, etc.), you may still be able to find the blobs that were in that commit.

git fsck can tell you if there are any problems with git's internal database. If that doesn't turn up anything, try this: How to recover LOST WORK resulting from the use of git?