Table of Contents

Git line endings problem

When line ending cross-platform differences are causing git to modify files (Warning: LF will be converted to CRLF or vice-versa): We can change config settings on each repo, or better yet, using shared .gitattributes file

More info here https://help.github.com/articles/dealing-with-line-endings/

Sample .gitattributes file when we want to force LF line endings here: https://gist.github.com/dpalomar/ebc64d6f56cfc25a3e5c20fe7cdfbd4f

# These settings are for any web project

# Handle line endings automatically for files detected as text
# and leave all files detected as binary untouched.
* text=auto

# Force the following filetypes to have unix eols, so Windows does not break them
*.* text eol=lf

# Windows forced line-endings
/.idea/* text eol=crlf

#
## These files are binary and should be left untouched
#

# (binary is a macro for -text -diff)
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.ico binary
*.mov binary
*.mp4 binary
*.mp3 binary
*.flv binary
*.fla binary
*.swf binary
*.gz binary
*.zip binary
*.7z binary
*.ttf binary
*.eot binary
*.woff binary
*.pyc binary
*.pdf binary
*.ez binary
*.bz2 binary
*.swp binary

Tested on

See also

References