due to a "feature" in Microsoft's Visual Studio, .sln files must have windows style line endings so that the windows explorer could open them in Visual studio. So I need to be able to commit this one particular file with line endings intact. It is fine if all other files get converted. The question is how to make git accept just one single file with windows endings?
Asked
Active
Viewed 1.2k times
1 Answers
102
Take a look at the gitatttributes documentation. With recent versions of git, you can set the eol attribute for files to control what end-of-lines will be used when the file is checked out.
You should be able to create a .gitattributes file in your repository that looking something like:
path/to/my/file eol=crlf
larsks
- 228,688
- 37
- 348
- 338
-
Could you update the URL: https://git-scm.com/docs/gitattributes -- Thanks. – natersoz Apr 07 '17 at 22:36
-
Updated! more words to make stackoverflow happy – larsks Apr 07 '17 at 22:55
-
Note: You might have to manually change the line endings and re commit the files as well – Ben Winding Jul 23 '20 at 01:56