Reputation: 31
I have yet another example of doing a git rm -rf
without an initial commit. (I realized I had added lots of useless files and wanted to add some filters.)
Now I am left with 23000 dangling blobs with no tree, but with a complete Git history!
I'll use a script to loop over the blobnames (using git show 'blobname' > 'filename'
), but can I associate these filenames from the history to the blobs?
Upvotes: 1
Views: 1304
Reputation: 31
For all of you who did/will do the exact mistake I made, here's the end of the story.
First off, a brief summary of what I did.
gid add .
git rm -rf
with the intent of then adding some filters in .gitignoreI tried all sort of data recovery tools; no luck. The best I could do was the following procedure.
git fsck --lost-found
possibly with --unreachable --cache
.git/lost-found/other
with all (most of?)
the original files were re-created, but without filenames. Now the problem was
how to recover the file names. Unfortunately, all the files I recovered were blobs, no roots, so I had no information about the tree structure of the directories.file
to look at the type of a file (file <filename>
), and attaches the corresponding extension to it. The problem of matching files with filenames still remains.Good luck!
Upvotes: 2