Solve Your End-of-line (eol) Problem For Good
Written by Eddie ZhangatDecember 30, 2024
eol
setup for your editor
.vscode/settings.json
json{ "files.eol": "\n" }
.editorconfig
fileeditorconfig[*] end_of_line = lf
for frontend developers
.prettierrc
filejson{ "endOfLine": "lf" }
but it still happens
git commit
, git saves your code in CRLF on windows, while LF on linux/macos..gitattributes
filetext* text=auto eol=lf *.{cmd,[cC][mM][dD]} text eol=crlf *.{bat,[bB][aA][tT]} text eol=crlf
not done yet
bashgit ls-files --eol # inspect if there are files use crlf git rm --cached -r . # clear git index git reset --hard