I have a Windows box which has taken it into it's head to delete most of a Git repository (must have tripped the Important Work Detector ;). All I have left (that I can find) is the objects. I'm not sure how complete the collection of objects is, either. Is it possible to recover things from just the objects? As far as I can tell, the object tree is intact. All the packs and loose objects are in place; I just don't have the metadata to convince Git.
问题:
回答1:
The first thing that I would try is to initialize a new repository with git init
. Then I'd copy the objects directory from the dead repository into the new repository. Then I'd run git fsck
in the new repository.
With some luck you'll see a whole lot of dangling objects and with a bit more luck some of the dangling objects will be commit objects which will be the tips of lost branches.
If you run git show
and/or git log
on these commits you may be able to recognize some of the branches.
To "recover" them you can just use git branch
to recreate named branches.
回答2:
If you haven't already tried git checkout master
, I'd start with that.
回答3:
try using this post
How to recover Git objects damaged by hard disk failure?
that answer may have some *nix related info. Let me know if it helps.
Ill see what it does.