2025/03/03

Force LF EOL In Git

Windows 以及 MacOS 或 Linux 的換行符號是不太一樣的,Windows 是 CRLF,Linux like 是 LF,在 Windows 使用 git 如果沒有有設定參數,pullcommit 時 git 有可能會幫你自己轉換行符號,這樣會導致 git 在你沒有修改任何內容的情況下判定你有更改檔案,為了避免這樣的狀況最好是設定以下的內容:

$ git config core.eol lf
$ git config core.autocrlf input

Reference

github - Force LF eol in git repo and working copy - Stack Overflow

沒有留言: