soid
soid

Reputation: 551

What is a dangling tree? New Git repository has dangling tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904

What is a dangling tree?

I am new to Git and I am using the latest Git-GUI for Windows. The dangling tree is reported when I do a Git-GUI Repository : Verify Database after creating a new repository:

Git fsck dangling tree

This is my newly created empty repository:

enter image description here

It says 'Success' but when I search for 'dangling tree' there seem to be reports of problems and when I search for 'What is a dangling tree' I get no results. I would like to know in general what a dangling tree is, what it is in this particular instance and is this one a problem.

Upvotes: 4

Views: 9477

Answers (1)

jthill
jthill

Reputation: 60413

What is a dangling tree?

"Dangling" is git's slightly quirky spelling of "unreferenced".

4b825dc642cb6eb9a060e54bf8d69288fbee4904 in new repository

That's the SHA of the empty-tree, git mktree </dev/null will make it. Something, somewhere, in your repo's initialization has made that, perhaps looking for a null root commit, or perhaps you have a template repository with that in it, or some status-inquiry command has done it.

If git fsck's notice is irksome the easy fix is to reference it, and you can even maybe get some use out of it with

git commit-tree -mempty\ tree 4b825dc642 | xargs git tag empty

Upvotes: 8

Related Questions