====== Git CRLF 처리 방식 ====== Linux/Mac/Windows 등의 다양한 운영체제에서 프로그래밍을 할 경우 항상 EOL의 값 ''CRLF''와 ''LF''간의 충돌이 발생한다. ''LF''로 통일하고 ''*.bat'', ''*.cmd'' 파일만 ''CRLF''로 하는 것이 나아보인다. * http://stackoverflow.com/questions/170961/whats-the-best-crlf-handling-strategy-with-git : 2번째 답변 * https://help.github.com/articles/dealing-with-line-endings : 자세한 정리 * https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html : 매뉴얼 ===== CRLF -> LF 전환 ===== * 먼저 CRLF 혹은 LF를 강제해야할 모든 파일을 ''dos2unix'', ''unix2dos'' 명령으로 올바른 형태로 모두 바꾼다. find . -name "*.java" -exec dos2unix {} \; find . -name "*.groovy" -exec dos2unix {} \; # ... * 해당 상태를 커밋한다. * 이제 ''.gitattributes''에 파일별 상태를 기술한다. * ''.gitattributes'' 파일 자체를 커밋한다. ===== dos2unix/unix2dos ===== ''dos2unix'' 패키지를 설치하고 ''dos2unix'', ''unix2dos'', ''unix2mac'' 등의 명령으로 테스트해본다. ===== .gitattributes 예 ===== * text=auto *.bat text eol=crlf *.cmd text eol=crlf *.java text elo=lf *.groovy text eol=lf *.py text eol=lf *.rb text eol=lf *.gradle text eol=lf *.properties text eol=lf *.xml text eol=lf *.sql text eol=lf *.txt text eol=lf *.md text eol=lf *.ftl text eol=lf *.jade text eol=lf *.jsp text eol=lf *.jspf text eol=lf gradlew text eol=lf 오직 ''LF''만.. * text eol=lf