My git repository got into a strange state today. A file was reported by git status as modified, but git diff showed no changes. After a searching on internet, I checked the file attributes (read/write/execute and owner GID/UID) and content (in case it was a line endings issue). The attributes were correctly set, and md5sum theFile and git show HEAD:theFile | md5sum reported the same hash.
I then tried to overwrite the working tree file with the one stored in git: git show HEAD:theFile > theFile. Surprisingly, git status continued to report changes on this file.
Then, I checked out the file: git checkout -- theFile, and after that, git status changed its opinion and reported no changes on theFile.
I can't understand the difference between show HEAD:theFile > theFile and checkout -- theFile. Maybe git is keeping information in cache, which is updated by checkout but not by show ... > ?