Git - how to recover from a missing blob

后端 未结 2 1071
野的像风
野的像风 2020-12-15 08:28

I\'m running git 1.6.4.2. Garbage collection is failing saying \"error: unable to find \".

I\'ve managed to determine that the missing obje

相关标签:
2条回答
  • 2020-12-15 08:59

    I had the same problem (missing blob) and the solution with

    git reflog expire --expire=now --all
    

    didn't do the trick. I found my solution here : https://git.wiki.kernel.org/index.php/GitFaq#How_to_fix_a_broken_repository.3F

    This simple line

    git hash-object -w <file>
    

    Fixed the missing blob.

    Hope this helps.

    0 讨论(0)
  • 2020-12-15 09:04

    After a bit more digging it turns out that my question is answered here: How to delete a blob from git repo - git prune wasn't pruning the stuff I'd wound back because the reflog was still referring to it. Running

    git reflog expire --expire=now --all
    

    fixed that. Also, the referenced post gives a mechanism for running git lstree on every commit to find the referenced blob.

    0 讨论(0)
提交回复
热议问题