I have a folder with lots of .cs files. Some of these files (for some reason) are tracked as binary and the git diff
command doesn\'t work normally with them.
I
You can do this to force git to think it's text:
*.cs diff
You'll want to make sure it actually is text though. Forcing Git to think your file is text when it actually isn't can cause extremely bad behavior in a variety of situations.
You may need to set a couple of other attributes too:
*.cs diff merge text
The text is useful for EOL normalization. You might need merge if Git still thinks the files are binary at merge time.
However, the real question is "Why is Git marking my file as binary?" The answer is because it's seeing a NUL (0) byte somewhere within the first 8000 characters of the file. Typically, that happens because the file is being saved as something other than UTF-8. So, it's likely being saved as UCS-2, UCS-4, UTF-16, or UTF-32. All of those have embedded NUL characters when using ASCII characters. So, while your question says you did re-saved the files as UTF-8, you may want to check again with a hex editor. I suspect that they are not UTF-8, and that's the core of the problem.
In Sourcetree version 3.1.2: