如何在 Git for Windows 中将行结尾规范化为 LF
How to normalize line endings to LF in Git for Windows
我正在使用Git for Windows 1.9.5;我的远程存储库有混合行结尾(一些 CRLF 一些 LF)。我想将远程存储库规范化为完全 LF。
我的设置:
git config core.eol lf
git config core.autocrlf false
.gitattributes * text=auto
我试过:
Refreshing a respoitory after changing line endings
git rm --cached -r .
git reset --hard
git status
rm .git/index # Remove the index to force git to
git reset # re-scan the working directory
git status # Show files that will be normalized
This SO answer
git rm --cached -rf .
git diff --cached --name-only -z | xargs -n 50 -0 git add -f
git ls-files -z | xargs -0 rm
git checkout .
git status
在 git status
之后,我在文本编辑器中打开了一些文件样本,并希望它们从 CRLF 变为 LF 行尾,但 none 已经。
我需要做什么才能将本地和远程存储库中的所有行结尾更改为 LF?
您想在远程存储库上设置 CRLF。你确定吗?其他人会反对吗?
提交更改后,您是否已将它们推送到远程?
在您的 .gitattributes
中,您需要设置
eol=crlf
text=auto
当您执行 git status
时,您应该注意到您有很多 "changed" 文件。如果你犯了这些,那就是鳗鱼变了。
我正在使用Git for Windows 1.9.5;我的远程存储库有混合行结尾(一些 CRLF 一些 LF)。我想将远程存储库规范化为完全 LF。
我的设置:
git config core.eol lf
git config core.autocrlf false
.gitattributes * text=auto
我试过:
Refreshing a respoitory after changing line endings
git rm --cached -r .
git reset --hard
git status
rm .git/index # Remove the index to force git to
git reset # re-scan the working directory
git status # Show files that will be normalized
This SO answer
git rm --cached -rf .
git diff --cached --name-only -z | xargs -n 50 -0 git add -f
git ls-files -z | xargs -0 rm
git checkout .
git status
在 git status
之后,我在文本编辑器中打开了一些文件样本,并希望它们从 CRLF 变为 LF 行尾,但 none 已经。
我需要做什么才能将本地和远程存储库中的所有行结尾更改为 LF?
您想在远程存储库上设置 CRLF。你确定吗?其他人会反对吗?
提交更改后,您是否已将它们推送到远程?
在您的 .gitattributes
中,您需要设置
eol=crlf
text=auto
当您执行 git status
时,您应该注意到您有很多 "changed" 文件。如果你犯了这些,那就是鳗鱼变了。