gitgit-fsck

Git fsck --unreachable --lost-found does not save objects as files at the lost-found directory


I used fsck and found that I have some dangling objects, and more than that (in amount) unreachable objects.

fsck --lost-found does save the dangling objects as files at the lost-found directory, but when I want for it to write all unreachable objects with fsck --unreachable --lost-found it does not write them, so I end up missing some unreachable objects.

Why does that happen and is there a way for Git to write those unreachable objects as well into files?


Solution

  • Solution found: --lost-found supports only dangling objects, according to the Git documentation:

    --lost-found Write dangling objects into .git/lost-found/commit/ or .git/lost-found/other/, depending on type. If the object is a blob, the contents are written into the file, rather than its object name.

    https://git-scm.com/docs/git-fsck#Documentation/git-fsck.txt---lost-found