I think the real problem you need to deal with is how the files are different, and what is the difference you expect to see?
The traditional default is that git does not change the contents of the file to git add in the repository. Later git installer windows include core.autocrlf , which takes unix to the end of the Windows line to checkout, and reverse to add to the repository.
For this reason, if you have more expected changes, you often think that git add all pending files (for example, via git add -u ).
At this stage, any cleaning / lubrication filters will be applied, and git diff --cached should give a reasonable spread.
If you have supplied files that git thinks differently but the difference is not visible, you may need to look at the raw bytes to see if there are any differences in invisible characters.
You can use a tool like hexdump .
Assuming myfile.txt has differences that are not visible, you can try something like this.
source share