User Tools

Site Tools


wiki:git_line_endings_problem

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

wiki/git_line_endings_problem.txt · Last modified: 2021/03/30 13:41 by antisa

Except where otherwise noted, content on this wiki is licensed under the following license: CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki