2013-02-23 76 views
2

网络充满了关于新线分裂历史的解释。但是我无法找到一个答案,究竟世界是否最终达成了一个标准来结束这条路线。要使用哪行结尾/换行符?

给定一个在linux和windows机器上开发和使用的Java项目。这将是源文件中换行符的最佳选择:cr或crlf?

将所有crlf转换为已存在的代码库中的cr是否合理?也许这样做与SVN一起Git迁移?

+0

Scott Hanselamn几天前发布了一篇关于此的博客文章:) http://www.hanselman.com/blog/YoureJustAnotherCarriageReturnLineFeedInTheWall.aspx – d1mitar 2013-02-23 10:19:12

回答

2

EOLS是单独为每个文件

         | 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 

看一看这个post about EOLs了解详情。

还可以查看SVNKit存储库(git clone http://svn.svnkit.com/git/svnkit)中的.gitattributes,作为EOL良好使用Git属性的示例。