title: How can I recover from a missing blob in a Git repository?
body: <p>I'm running Git 1.6.4.2. Garbage collection is failing saying &quot;error: unable to find <code>&lt;SHA1&gt;</code>&quot;.</p>
  <p>I've managed to determine that the missing object is a blob, and there is no way that I can get the blob file back.  It seems that two scripts that run &quot;git add&quot; and &quot;git commit&quot; were running at the same time and managed to interfere with each other so that one committed a newer version of a file than the other, and the older version's blob vanished.</p>
  <p>So I'm trying to roll back my repository to take out the commit that refers to the tree that refers to the missing blob.</p>
  <p>I know which branch the commit was on, so I ran &quot;git reset&quot; on it to rewind to the parent of the duff commit.  And I know that the branch was merged somewhere else, so I rewound that branch too.  So as far as I know, the duff commit/tree/blob are not referenced by anything.  But if I run <code>git prune --expire=now</code> followed by <code>git gc</code> then I still get an error about the missing object.</p>
  <p>How can I query the Git database to find every tree object that contains the duff blob id?  And how do I then find out what is causing Git prune to retain it?</p>