Subject: Re: rebuild repo from data, packfiles?

From: Jonathan Nieder <[email-masked]>
Date: Sat, 20 Nov 2010 21:27:07 -0600

tom fogal wrote:

> My thought is to cat-file all my commits, filter out the ones which are
> upstream, order them by date, and git-am them back into a repo.
> 
> Some of my data only exist in blobs, though... maybe git-diff-tree
> can get me the patch I need?  Not quite sure what to diff it with,
> though... maybe the most-recent sha1 I have, based on date?
> 
> Other ideas would certainly be welcome!

What did "git fsck" say?

If it is possible to unambiguously recover your data without using any
external knowledge, then that would imply a bug imho --- why doesn't
git do it automatically?  Chances are some objects are missing ---
blobs, trees, commits, or tags --- and you will have to fill in some
information for a full recovery.

Perhaps you have another copy of those objects somewhere.  Have you
ever cloned this repo or pushed to another machine?

Sometimes it is possible to recover some specific object with
detective work; see howto/recover-corrupted-blob-object.txt in the
Documentation directory for an example of that.

git does not use text diffs for its object storage.  The information
the repository can give you directly consists of binary deltas and
full objects.

Are the old refs (branches and tags) intact?  More generally, what
files does

 ls -lR .git

list in the old repository?

Regards,
Jonathan