Thomas Koch
Thomas Koch

Reputation: 2951

Which line ending/newline to use?

The web is full of explanations about the history of the newline schism. But I can't find an answer whether the world has finally agreed on one standard to end a line.

Given a Java project that is developed and used on linux and windows machines. Which would be the best choice for newlines in the source files: cr or crlf?

Would it make sense to convert all crlf to cr in an already existing codebase? Maybe do this together with an SVN to Git migration?

Upvotes: 2

Views: 1278

Answers (1)

Dmitry Pavlenko
Dmitry Pavlenko

Reputation: 8978

EOLs are individual for each files

                                       | svn:eol-style |  Git attributes
For source code files --- native EOLs  |   native      |  !eol
For bash scripts --- LFs               |     LF        |  eol=lf
For bat scripts --- CRLFs              |    CRLF       |  eol=crlf
For binary files                       |  <not set>    |  -text

Have a look at this post about EOLs for details.

Also have a look at .gitattributes in SVNKit repository (git clone http://svn.svnkit.com/git/svnkit) as an example of good usage of Git attributes for EOLs.

Upvotes: 2

Related Questions