Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

My hard drive failed. No backups. (I know. I know.) Managed to clone the drive and recover most lost data. However, files and directories which were prefixed with dot (or blob) are now without their dot. So I have a visible directory called git with files (COMMIT_EDITMSG, config, description, HEAD and index) and directories (branches, hooks, info, logs, objects and refs). The objects directory has directories (eg. 00, 0a, 0b, etc.) and they each have files with SHA1 hash filenames. The git/objects/pack directory is empty. So from what I can tell... the data is there. I'm hoping I just need to rename the directory(ies) and filename(s) and maybe it'll all work again. Or is this wishful thinking?

Perhaps I should have added I'm using a Mac.

share|improve this question
    
Have you tried prepending a dot to the folders? (After you make a copy first) –  spuder Aug 24 '13 at 4:37

1 Answer 1

up vote 0 down vote accepted

Rename the git directory to .git. Run git fsck to check whether any files were corrupted; if it passes, update the working tree with git checkout -f.

share|improve this answer
    
Worked perfectly. All revisions, commits, comments etc appear in my xcode project as if it was never corrupted. –  Mike Aug 24 '13 at 17:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.