What exactly is a "grafted" commit in a shallow clone?

GitGit Clone

Git Problem Overview


When doing a shallow clone in git (using the --depth option), the root commit is marked as grafted.

enter image description here

Googling didn't lead to any satisfacting documentation.

It doesn't seem to have anything to do with git grafts, which the similar terminology would imply.
Is it just a flag to signal that this commit actually has more parents and isn't the "real" root commit? Or is there something more special about it?

Git Solutions


Solution 1 - Git

From your link:

> It works by letting users record fake ancestry information for commits. This way you can make git pretend the set of parents a commit has is different from what was recorded when the commit was created.

In a shallow clone, your root commit is one that should have parents, but not in your repo. So it seems a good use case for grafting.

In effect: > Def.: Shallow commits do have parents, but not in the shallow > repo, and therefore grafts are introduced pretending that > these commits have no parents.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSascha WolfView Question on Stackoverflow
Solution 1 - GitmgarciaisaiaView Answer on Stackoverflow