For a large existing repository that contains inconsistent line endings, and file encodings with ascii and UTF-8 (With BOM)...
The key thing is that the current set of files are fairly inconsistent. They vary in encoding. (Lets ignore UTF-16 for now, although I do have a few of those, too). They vary in line endings from file to file, and they vary in line endings within the files themselves too, although I suspect that most of them are stored with crlf line endings in git.
There are two main issues here:
1) Different people using the same repositories can look at changes, and they see a different set of changes. Sometimes the "whole file" has been changed, because of normalised line endings. Sometimes only a part of the file has been changed. This seems to be mostly dependent on whether or not core.autocrlf has been set to true or false, and also seems influenced by the use of a .gitattributes file.
2) I want all people to be able to submit files to the git repository, without having to pay painful attention to whether their particular git configuration has been set to do crlf conversion, or their text editor, IDE, or whatever tools they decided to use. (As broken as this behaviour can be on windows, we need to live with it...)
The main question is this: How do I be sure that the output shown by 'gitk', 'git diff', 'git show', and the like, are absolutely consistent with respect to the changes shown. I am less concerned about line endings here, and more about ensuring that the 'change' for a given commit is the same change as viewed by all developers. I do not want one person looking at a change, and see "all the lines have changed" (That is, the line endings changed), while another person sees the same change, and says: "three lines have changed".
- Note: Some people use github to view changes.
That said, I want to have confidence in knowing how the line endings are concerned, so I am ultimately asking for how to know what happens with the line endings. If, eg, I specify "eol=crlf" for a given file in .gitattributes, does that mean that the file is committed to git with that setting? And what happens if I check out an earlier version of that file that was committed prior to setting that .gitattributes file?