git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Axel Freyn <axel-freyn@gmx.de>
To: git mailing list <git@vger.kernel.org>
Subject: Re: How to recovery a corrupted git repo
Date: Mon, 21 Feb 2011 11:04:54 +0100	[thread overview]
Message-ID: <20110221100454.GM22168@axel> (raw)
In-Reply-To: <AANLkTi=W3RckA=e-YwDJzELaEOAa+7P74V-G0G=bQhex@mail.gmail.com>

Hi,
On Mon, Feb 21, 2011 at 03:50:09PM +0800, Ping Yin wrote:
> I have a corrupted git repo, with "git fsck", it shows
> 
> missing blob b71eb55f2dbc97dafd4a769fc61f346e69a5e0af
> missing blob 282035f3ae964e1e288f352c370be8edd11d3078
> missing tree 3c20f556eecc476e3542cc522d46a62a4461fec6
> missing blob f321b578edeb452358497e832815d6cae6b36886
> missing commit 6d23f5084c975be637f7d748db82116bf84d3872
> 
> And i also have a good backup repo. How can i recover the corrupted
> repo with the backup repo?
> 
> I can do a rsync or fresh "git clone", however, is there any git
> related commands to incrementally do this?
I don't know whether there is a single git command to do it, but you can
copy those 5 objects "by hand": in your backup, you should have a
directory .git/objects, where you have the files
   b7/1eb55f2dbc97dafd4a769fc61f346e69a5e0af
   28/2035f3ae964e1e288f352c370be8edd11d3078
   3c/20f556eecc476e3542cc522d46a62a4461fec6
   f3/21b578edeb452358497e832815d6cae6b36886
   6d/23f5084c975be637f7d748db82116bf84d3872

It should be sufficient to just copy those files into the corrupted
repo.

However if you packed the git-files in the backup (e.g. by running "git
gc"), those objects might be found in a pack in .git/objects/pack.
The easiest ist probably to use git-unpack-objects to unpack the
objects, and then copy the 5 missing objects.

Axel

PS: Well, I'm using git and I like it -- but I'm no specialist; so first
do a backup, before you follow my proposal ;-)

  parent reply	other threads:[~2011-02-21 10:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-21  7:50 How to recovery a corrupted git repo Ping Yin
2011-02-21  9:27 ` Christian Couder
2011-02-21 10:04 ` Axel Freyn [this message]
2011-02-21 10:11   ` Ping Yin
2011-02-21 14:51   ` Matthieu Moy
2011-02-21 15:03     ` Ping Yin
2011-02-21 15:31       ` Matthieu Moy
2011-02-22  3:16         ` Ping Yin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110221100454.GM22168@axel \
    --to=axel-freyn@gmx.de \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).