gitgit-fsck

Git - remove missing blobs or trees


Is there a way to remove references to a missing blob or tree from the history? Here is the output of git fsck --full

broken link from    tree 99fe1a9d46985ca21e88de53a7a290e2b1889722
              to    blob bf70d7b3bf98852e13dd0b3b8499ad5d77f174d9
broken link from    tree e3dbfdf73cb5c9971b95b33da5fc93f5d69acdae
              to    tree 5d02b92042c23945f41c5a895e5fc7f4d5a4988d
missing blob bf70d7b3bf98852e13dd0b3b8499ad5d77f174d9
missing blob 1d918846d68d8a8368cc442b6d5989d275944c39
dangling blob 42c2d0f36c782a48f793f6c381578e0e5611b602
missing tree 5d02b92042c23945f41c5a895e5fc7f4d5a4988d
missing blob e9d2ae0e7d9c30dec40a116a12a97567e29a87d2
dangling blob 1aa5f9b48ea74f4a75aa848c571f223995c36658
dangling blob 94055e2bdcc4399c5563327ff879864c59c95e40
dangling commit 2b46b23ef705d48c03ed2526cad6548d1608644b
missing blob 5f5e29e93984bdb1a4bc3be2ba7ebaba1e595e75

My guess is that either a pull,push, or git move got interrupted. I worked out which files most of the missing blobs referred too, but I cannot recover them since they have been since modified and I have no way of reconstructing the changes (I think; but I'm new to git).

gc, prune, and reflog --expire=now did not help.

Is there a way to tell git "It's OK buddy, I'm fine with the current state of the current HEAD"?


Solution

  • Interrupting Git will not do this. Having your system crash (reboot) while in the middle of some update might do this, but an ordinary interrupt would not. Disk failure would also do this.

    See Repair corrupted git repository and How to fix corrupted git repository? I would just mark this as a duplicate but I'm not sure which of these is a better question-and-answer (though I lean a bit towards the second one myself).