Git: what is a dangling commit/blob and where do they come from?

doub1ejack picture doub1ejack · Aug 29, 2013 · Viewed 68k times · Source

I'm looking for the basic info on dangling commits & blobs.

My repo seems fine. But I ran git fsck for the first time to see what it did and I have a long list of 'dangling blobs' and a single 'dangling commit'.

What are these things? Where did they come from? Do they indicate anything unusual (good or bad) about the state of my repo?

Answer

Elijah Lynn picture Elijah Lynn · Mar 6, 2014

Dangling blob = A change that made it to the staging area/index but never got committed. One thing that is amazing with git is that once it gets added to the staging area, you can always get it back because these blobs behave like commits in that they have a hash too!!

Dangling commit = A commit that isn't directly linked to by any child commit, branch, tag or other reference. You can get these back too!