I\'m trying to get my head around the way that git manages to \'remember\' a file\'s name and its path, given that it only stores file content within a blob. Is the explanat
git
defines four kinds of objects (Commit, Tag, Tree, Blob). Each object is identified after the hash of its content.
The three objects that are involved with renaming are :
blob: this correspond to a committed file, the content of the object is the compressed content of the original file
tree: this correspond to a directory listing, it contains a mapping of filename to other objects (either blobs or trees) and also record the access rigths
commit: this contains the commit message, a pointer to the parent commit(s) (except for the first commit), and to a tree object
So when you rename a file and commit it, a new tree object is created (well, and more than one if it is in a subdirectory) with a new mapping name to object, but the object is the same.
However, git does not track rename, it try to rediscover them by comparing file content. If two file are really similar, but have different names, it consider it is a rename. This can be time consuming, and if there are lots of file, it can fail.
Edit: Take a look to the Git Community Book, that has a really good explanation on how does git store information.