Key word here is why. There are plenty of questions where the answer is, "git doesn't allow that" but I want to know why it doesn't allow this.
I've been reading about the architecture of git and it has this image in it:
This image shows that there are tree
nodes. Technically, it looks like it'd be straight forward to save a tree
without any children. So why does git forbid this?
There's a part in this book that mentions this:
For each directory above the changed file (plus the repository root directory), a new tree object is created with a new identifier. A DAG is created starting from the newly created root tree object pointing to blobs (reusing existing blob references where the files content has not changed in this commit) and referencing the newly created blob in place of that file's previous blob object in the previous tree hierarchy. (A blob represents a file stored in the repository.)
I feel like this might be the reason, but it's kind of glossing over the details with respect to what I want answered.