Git error: There are too many unreachable loose objects

Nov 04, 2022 · 1 min read · Post a comment

Here I want to share a solution to the following Git error: There are too many unreachable loose objects. This usually happens when Git cannot cleanup all dangling commits as they are too many. Regarding the solution, it includes my favorite operation so far, removing dangling objects. To be clear, dangling commits and blobs are usually referred as dangling Git objects.


  • Git


Step 1. List dangling commits:

git fsck --lost-found | grep "^dangling commit" | sed 


  • git fsck verifies connectivity and validity of the Git objects too.
  • Adding option --lost-found will save dangling commits under .git/lost-found/commit. Blobs are stored under .git/lost-found/other though.

Related: Git 101: loose vs dangling vs unreachable objects.

Step 2. Initiate the Git garbage collector as it will remove the dangling objects:

git gc --aggressive --prune=now

Related: Git gc.


To find more neat Git commands and hacks, simply browse the Git category. Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.