Git is not a file versioning tool. Its file system versioning tool. How?

Git is not storing each and every file in the repository during the every commit. That is why it is not versioning tool.
Instead, Git looks at data more like a set of snapshots of a mini filesystem.
For every commit, Git takes a snapshot of what all your files, look like at that moment and stores a reference to that snapshot.
To be efficient, if files have not changed, Git doesn’t store the file again, just a link to the previous identical file it has already stored.