问题
So I have an old repo, with many files, some are CRLF, some are LF.
I want to
(1) change ALL files to LF (I have used dos2unix to convert my files, but git commit ignores those changes!) I have also set git config --global core.autocrlf to false.
(2) prohibit all future checkins that have CRLF or auto-convert them to LF.
How do I do so?
Sorry for the rant. I have read multiple posts here and I can't believe this is so counterintuitive. I have seem many configs like core.safecrlf, core.autocrlf, .gitattributes etc, but I can't believe this simple task is so complicated for people to master and error messages are so unclear.
回答1:
Try to set following in your .gitattributes and refresh your repository:
* text eol=lf
来源:https://stackoverflow.com/questions/27625299/what-is-the-easiest-way-to-convert-all-files-in-git-repo-to-lf-line-endings