2022-04-25 git autocrlf
git autocrlf
git の autocrlf の設定を見直した。
なぜなら下記の問題が発生したから。
では、repositoryにCRLFが紛れてしまう恐れがある設定は何でしょうか。 それはcore.autocrlfがfalseの場合です。
気をつけて!Git for Windowsにおける改行コード - Qiita
true にすりゃいいじゃん!と思ったけど必ずしもそうではない。
$ git config --global core.autocrlf true
ビルド作業のことや、想定していない改行コードの不具合を出さないようにするには
git config --global core.autocrlf input
結論
$ git config --global core.autocrlf input
.gitattributes で制御
.gitattributes
で制御も可能。
* text=auto
CRLF vs. LF: Normalizing Line Endings in Git
CRLF が紛れ込んでしまったとき
確認
$ git ls-files --eol
修正
$ git add --renormalize .
$ git commit