The Git index in this repo currently contains a mix of source files with LF and CRLF line endings. This PR enables Git's autocrlf feature by adding * text=auto to .gitattributes. This forces all files in the Git index to use LF (which most of them already are do anyway). Checked are converted automatically to CRLF on Windows.
IDEs are usually smart enough to keep using the previous line endings in existing but can revert to the system default one when adding new files to the repo. It usually a good idea to prevent that by setting and forgetting the appropriate lines in .gitattributes.
To fix the Git index line endings in some other branch: git add . --renormalize and commit.
To fix the line endings in your working tree: git rm --cached -r . && git reset --hard
Here's a diff of git ls-files --eol before and after:
The Git index in this repo currently contains a mix of source files with LF and CRLF line endings. This PR enables Git's autocrlf feature by adding
* text=auto
to.gitattributes
. This forces all files in the Git index to use LF (which most of them already are do anyway). Checked are converted automatically to CRLF on Windows.IDEs are usually smart enough to keep using the previous line endings in existing but can revert to the system default one when adding new files to the repo. It usually a good idea to prevent that by setting and forgetting the appropriate lines in .gitattributes.
To fix the Git index line endings in some other branch:
git add . --renormalize
and commit. To fix the line endings in your working tree:git rm --cached -r . && git reset --hard
Here's a diff of
git ls-files --eol
before and after: