You can find your answer in the free Pro-Git book in the Git chapter, Internal Versions.
This chapter explains how git works behind the hood.
As Leo said, git checks the SHA1 files to see if it has changed, you can check it (taken from git Internals):
$ echo 'version 1' > test.txt $ git hash-object -w test.txt 83baae61804e65cc73a7201a7252750c76066a30
Then write the new contents to the file and save it again:
$ echo 'version 2' > test.txt $ git hash-object -w test.txt 1f7a7a472abf3dd9643fd615f6da379c4acb3e3a
stdcall
source share