You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The repository seems to have some files with windows EOL and other with Linux EOL. Since different developers may have system wide settings that differ it would be nice if a .gitattributes file was added so there are no more EOL issues when people do PR. Some editors like MSVS change EOL silently and asking everyone to change their system configuration is harder than just use a per-repository setting which ensures it always work.
Here is a .gitattributes file I used with success. It could be expanded or modified if needed.
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto
# Declare files that will always have CRLF line endings on checkout.
*.sln text eol=crlf
*.props text eol=crlf
*.vcxproj text eol=crlf
*.vcxproj.filters text eol=crlf
The .gitattributes files only affect new commits so the existing file need a one time normalization. As taken from http://git-scm.com/docs/gitattributes this does the trick
$ rm .git/index # Remove the index to force Git to
$ git reset # re-scan the working directory
$ git status # Show files that will be normalized
$ git add -u
$ git add .gitattributes
$ git commit -m "Introduce end-of-line normalization"
Now all files in .git are stored with LF. On checkout it will use the native EOL except for the VS files which will always checkout with CRLF.
To test this I went out of my way and changed all the line endings to LF to try and make a EOL error and git correctly warned me and did not introduce EOL changes and kept using CRLF since I was on windows. Basically git will always ignore EOL in commits now and github will not throw fits since to github all the files have LF.
At first glance 500 files changed may seem to introduce a lot of rebasing for PR and branches but looking at the list most of the files affected are MSVS and 3rdparty files. Which should not introduce that many merge conflicts.
This is more of a wishlist kind of thing but seems useful since I have seen EOL issues in several PR in the past.
The text was updated successfully, but these errors were encountered:
Hello,
The repository seems to have some files with windows EOL and other with Linux EOL. Since different developers may have system wide settings that differ it would be nice if a .gitattributes file was added so there are no more EOL issues when people do PR. Some editors like MSVS change EOL silently and asking everyone to change their system configuration is harder than just use a per-repository setting which ensures it always work.
Here is a github take on this:
https://help.github.com/articles/dealing-with-line-endings/
Here is a .gitattributes file I used with success. It could be expanded or modified if needed.
The .gitattributes files only affect new commits so the existing file need a one time normalization. As taken from http://git-scm.com/docs/gitattributes this does the trick
After doing this I got
Now all files in .git are stored with LF. On checkout it will use the native EOL except for the VS files which will always checkout with CRLF.
To test this I went out of my way and changed all the line endings to LF to try and make a EOL error and git correctly warned me and did not introduce EOL changes and kept using CRLF since I was on windows. Basically git will always ignore EOL in commits now and github will not throw fits since to github all the files have LF.
At first glance 500 files changed may seem to introduce a lot of rebasing for PR and branches but looking at the list most of the files affected are MSVS and 3rdparty files. Which should not introduce that many merge conflicts.
This is more of a wishlist kind of thing but seems useful since I have seen EOL issues in several PR in the past.
The text was updated successfully, but these errors were encountered: