In git, what is the difference between a dangling commit and a dangling blob?

StackOverflow https://stackoverflow.com/questions/10206732

  •  01-06-2021
  •  | 
  •  

Pergunta

When I do a git fsck, I see a list of dangling objects. Some of these are called dangling commits while others are called dangling blobs. I was wondering as to what the exact difference between these two is.

Foi útil?

Solução

Git creates blob for every file in the repository (unless the same content already exists). Dangling blobs are blobs not associated with any commit and are no much use unless your repository was broken in case of disk failure, etc.

You can see their contents using git show <blob SHA-1>.

Dangling commits, are the commits, which are not reachable from HEAD of any branch. You can still use them, for example by invoking git cherry-pick <SHA-1> or git reset <SHA-1>.

There is more explanation in Scott Chacon's Git user's manual.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top