This change ensures that devs using Windows:
1) Will avoid accidentally pushing modified files with CRLF line endings (i.e. this repo will maintain a consistent use of LF line endings)
2) Won't see files as modified in git due to line ending changes
3) Can still use CRLF in their working trees
By default, git doesn't perform any line ending normalization. Therefore, Windows devs will use CRLF line endings, and Unix/Mac devs will use LF. If a file is saved on Windows, line endings will be replaced with CRLF, even if nothing else changed in the file. This is difficult to detect, other than git showing that the file has been modified, and a warning:
warning: in the working copy of '', LF will be replaced by CRLF the next time Git touches it
It's possible for Windows developers to configure their local git to use CRLF in the working tree and only commit files with LF line endings, but this requires all Windows developers to modify their git config. With this new .gitattributes file and the line, no configuration is needed from developers.
This change ensures that devs using Windows: 1) Will avoid accidentally pushing modified files with CRLF line endings (i.e. this repo will maintain a consistent use of LF line endings) 2) Won't see files as modified in git due to line ending changes 3) Can still use CRLF in their working trees
By default, git doesn't perform any line ending normalization. Therefore, Windows devs will use CRLF line endings, and Unix/Mac devs will use LF. If a file is saved on Windows, line endings will be replaced with CRLF, even if nothing else changed in the file. This is difficult to detect, other than git showing that the file has been modified, and a warning:
It's possible for Windows developers to configure their local git to use CRLF in the working tree and only commit files with LF line endings, but this requires all Windows developers to modify their git config. With this new
.gitattributes
file and the line, no configuration is needed from developers.