When working on a local repo, how does Git know when a file is modified?
How would it know if something “unexpected” happened. For example, what if part of the disk (SSD) failed and a file got truncated?
Also, how would you know if your local Git repo database (or whatever it is) became corrupted?
Git uses the SHA1 hash function to ensure integrity of the repo contents. The 40 character commit ID you see is actualy the output of the hash function. I think it is the combination of file contents, parent commit hash, commit message, commit time, commit author that gets hashed.