Search code examples
gitobjectblobcorrupt

How to fix missing blob on git local feature which has not yet been published to remote repo


I have a pressing issue, I noticed that my computer went off automatically and when I rebooted , I had just about 3 uncommitted files on the local feature branch because I was testing out something which eventually worked

So it read the below on git fsck --full error: object file .git/objects/39/c8501fffd1b80fc2c2d483f6394537943a466c is empty error: unable to mmap .git/objects/39/c8501fffd1b80fc2c2d483f6394537943a466c: No such file or directory error: 39c8501fffd1b80fc2c2d483f6394537943a466c: object corrupt or missing: .git/objects/39/c8501fffd1b80fc2c2d483f6394537943a466c Checking object directories: 100% (256/256), done. Checking objects: 100% (2714/2714), done.

I made a backup of the one above I deleted the blob object and the physical file , readded a new one which I named to the file name causing it , that is the error and now get this error ,

**> Checking object directories: 100% (256/256), done. Checking objects:

100% (2714/2714), done. broken link from tree 375d0e935a25ad6c1fd56fcf9ad59efc251efc54 to blob 39c8501fffd1b80fc2c2d483f6394537943a466c**

PlEASE HELP becaause I want to merge the branch now and then push to the remote repo


Solution

  • I finally fixed it. The following highlights my steps:

    1. I cloned the remote repo
    2. I already have a backup of the current one
    3. I merged the feature testing local branch with a branch which was already being deployed to remote origin
    4. I removed the .git folder(from the corrupted one)
    5. I copied the whole .git in the current folder to the present corrupt one

    With the new git in place and the old .git out, it automatically makes git to start reading changes made from where it last stopped. Finally all worked and I successfully pushed to git remote origin without any third party tool like git-repair, git-filter-folder and the pain of having to reinitialize my complete folder