I am missing a bunch of LFS objects in my git repository*, both on the clients and the server. I am aware that those objects are lost and that's okay. Unfortunately this means that git lfs fetch --all
or even git lfs push --all origin
will fail.
I would like to purge the "broken pointers" from the repository, either by replacing the binary with a dummy text file or by removing the pointer altogether. I am also aware that this involves rewriting history and that's also fine.
What would be the best way to proceed?
*To clarify, I am missing some LFS files on the server but not all of them and not for all revisions of those files.
For example, I have foo.png that has been modified in 3 commits:
- foo.png (Version 1, LFS Sha: 03cfd743)
- foo.png (Version 2, LFS Sha: 661f0797)
- foo.png (Version 3, LFS Sha: 5fa2f122)
The LFS server no longer has foo.png version 2, so I would like to remove that commit from history. Unfortunately git lfs does not tell me which commit is broken, it simply tells me that 661f0797
is missing.
(For the record, I have found the missing files so I no longer have this issue but the solution should still be interesting!)