Git has this "feature" of auto-converting line endings for your local platform. Some of my projects build files for both Windows and Unix platforms - those outputs need to be correct for their targets, irrespective of what platform is doing the build. Therefore I prefer to prevent it from doing any conversion and have the files always unchanged. Modern text editors can render different line endings without a problem and I don't want my version control messing with my files.
You need to do all of the following steps:
First, the line-end changing behaviour must be disabled with:
git config --global core.autocrlf=false
Second, to keep the files correct in future (and before you check-in the "fixed" files), check-in a .gitattributes
file in the root of your project something like this:
*.bat text eol=crlf
*.cmd text eol=crlf
*.properties text eol=lf
*.pl text eol=lf
*.py text eol=lf
Finally, you need to fix the incorrect local files. Convert the line endings to LF with:
dos2unix filename
or to CRLF with
unix2dos filename
(use the git-bash shell if on windows). Then check them in.