
When git checkout commit, found error Fix Unable to read tree like that.
It cause by dangling commit and dangling blob in repository.
Dangling commit: Commit that isn’t directly linked to by any child commit, branch, tag or other reference
Dangling blob: A change that made it to the staging area/index, but never got committed.
These dragging commit and blob can found in command below:
git fsck --name-objects
Output:
Run command below to clean danging commit / blob and clean up repository
cd $REPO_PATH ## Remove all danging commit and blob and GC collect. git reflog expire --expire=now --all git gc --prune=now ## Clean up local old / conflict branch git remote prune origin
Leave a Reply