I try to understand the plumbings command of git and how it's low-level actions build the high-level actions like add and commit.
I know, that each time when I used the:
git update-index file.txt
i create the blob from this file and create the reference (name of file and SHA1 key written together) in index (of course only if the file is changed). If i make commit, i create the the tree which point only to one blob (I was changing only the one file).
But in the .git/objects database is stored not one, but more (for example five or six) blobs created by the update-index command from this one file, which aren't pointed by any tree pointed by any commit object. The git should save only this blob, which are in snapshots created by commit.
Git has some automatic garbage collection, which can remove the not-pointed blob in the future? And the command update-index is the full equivalent for add command?