Question

As I use GitHub For Windows, I accumulate dangling commits and dangling blobs in my repo. Is this normal, expected behavior? (I suspect the answer is YES.)

For example, using the GitHub for Windows program I create a new repo, commit the 2 files (.gitattributes and .gitignore) that it gives me for free when I created the repo, and then "publish" the repo to GitHub. All magic, all good, all easy. But git fsck tells me I have a dangling commit:

C:\Users\Robert\Documents\GitHub\test1 [master]> git fsck
Checking object directories: 100% (256/256), done.
dangling commit e67c154ce480637b51f5afb692688e16af1a7720

Ok, so lets ask git for some details about the dangling commit:

C:\Users\Robert\Documents\GitHub\test1 [master]> git log --oneline e67c
e67c154 Auto-generated backup commit: 05/11/2014 16:50:05 +00:00

It appears to be some sort of "Auto-generated backup commit" (thank you GitHub for giving me a decent comment). I've looked at other dangling commits this way and they appear to be more of the same.

I can use git show to view the contents of the dangling blobs, which all appear to be files I recognize.

So, back to the original question: Is this (accumulating dangling commits and blobs) expected behavior?

Was it helpful?

Solution

It appears to be some sort of "Auto-generated backup commit"

This is a GitHub for Windows hack that (more or less) auto-save your working directory. This feature greatly help their support team when a git newcomer messes up his repo. Thanks to those backup commits, the support team is able to "recover" their uncommitted work.

Is accumulating dangling commits and blobs expected behavior?

Yes, that's an expected git behavior. Every time you unstage a file, or partially update one, this leads to dangling blobs. Every time you rebase a branch, or rewrite your history, this leads to dangling commits.

This is part of what makes git "safe-by-default". Everything is persisted, and through the reflog (or the output of git fsck) one is able to access those previous states/snapshots.

Those dangling objects will be automatically cleaned up according to you config settings (see git gc documentation) or the next time you'll the git gc command.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top