Rebuild loose missing tree in Git when there are no other missing objects
My Git repository claims there is a corrupted object: running
git fsck --full says that there’s a corrupted loose object in the repo. Since the object is corrupted, I can’t unpack it using
git cat-file -t, but removing the file causes fsck to report only:
broken link from tree 93e54230ef... to tree 5aec4ad... missing tree 5aec4ad...
I think this missing tree is the only file that is missing, or rather that there are no dangling commits/blobs, because running
git ls-tree 93e54230ef... shows only one line:
040000 tree 5aec4ad... android. Also, the last-modified date on the corrupted file is yesterday, and I haven’t made any changes since then. Unfortunately, I’ve checked the clones I have of this repository, but none of them have the missing object packed or unpacked.
- How to push to a remote branch without providing the full push refspec?
- Rewinding remote git branch
- hg-git push results in duplicate commit history
- Git merge accidental commit to development branch
- pull specific commit/file from git
- Two variants of same code in git: Branch, fork, or make separate repository?
How can I rebuild a missing git tree with no dangling commits or blobs?
One Solution collect form web for “Rebuild loose missing tree in Git when there are no other missing objects”
When all that is missing in Git is a tree, the solution is simply to use write-tree:
After executing that command, the Git repository should revert to its previous state.