git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: rebuild repo from data, packfiles?

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Nov 21, 2010, 03:27 UTC
Message-ID
<20101121032707.GA11571@burratino>
In-Reply-To
<auto-000024045093@sci.utah.edu>
tom fogal wrote:
Show 8 quoted lines
> 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

Previous: tom fogalNext: tom fogal
Message 4 of 7 in “rebuild repo from data, packfiles?”
  1. tom fogalNov 20, 2010
  2. Jonathan NiederNov 21, 2010
  3. tom fogalNov 21, 2010
  4. Jonathan NiederNov 21, 2010
  5. tom fogalNov 21, 2010
  6. Jonathan NiederNov 21, 2010
  7. tom fogalNov 21, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.