Used to get this a lot, these days I tend to just use LF, rather than CRLF, and after adding a .editorconfig file to set the line ending the problem mostly went away. In the end I think I also needed to adjust some git configuration to stop it constantly converting files back to CRLF