Could somebody explain how git knows internally that files X, Y and Z have changed? What is the process behind the scenes that recognizes when a file has not yet been added or h
You can find your answer in the free book Pro-Git on chapter Git Internals
This chapter explains how git works behind the hood.
As Leo stated, git checks the SHA1 of the files to see if it has changed you can check it like this (Taken from Git Internals):
$ echo 'version 1' > test.txt
$ git hash-object -w test.txt
83baae61804e65cc73a7201a7252750c76066a30
Then, write some new content to the file, and save it again:
$ echo 'version 2' > test.txt
$ git hash-object -w test.txt
1f7a7a472abf3dd9643fd615f6da379c4acb3e3a