What is a dangling commit and a blob in a Git repository and where do they come from?

During the course of working with your Git repository, you may end up backing out of operations, and making other moves that cause intermediary blobs, and even some things that Git does for you to help avoid loss of information.

Eventually (conditionally, according to the git gc man page) it will perform garbage collection and clean these things up. You can also force it by invoking the garbage collection process, git gc.

For more information about this, see Maintenance and Data Recover on the git-scm site.

A manual run of GC will by default leave two weeks prior to the runtime of this command as a safety net. It is in fact encouraged to run the GC occasionally to help ensure performant use of your Git repository. Like anything, though, you should understand what it is doing before destroying those things that may be important to you.

Leave a Comment