How to solve the problem of newline characters of AutoCRLF and SafeCRLF in Git
This article is about how to solve AutoCRLF and SafeCRLF newline problems in Git. Xiaobian thinks it is quite practical, so share it with everyone for reference. Let's follow Xiaobian and have a look.
Recently, using GitHub, I found files that have not been modified from time to time to submit. Compared with the files that have been modified, I can't find anything different. Think it may be a newline problem, because Windows and Linux newlines are not the same, and Git should be Linux by default, Bing today, it is really this problem. CR LF carriage return Windows/Dos CRLF \r\nLinux/Unix LF \nMacOS CR \rSolution is: Open the command line, set it, if you are developing under Windows, it is recommended to set autocrlf to true. 2014/08/20 Supplement: If your file code is UTF8 and contains Chinese text, set autocrlf to false, convert all files to Linux code (LF\n), and turn on safecrlf check. AutoCRLF#is converted to LF when submitted and CRLFgit config --global core.autocrlf true when detected #Convert to LF on submission, not git config --global core.autocrlf input on checkout #Submit checkouts without converting git config --global core.autocrlf false
II. SafeCRLF
#refuse to submit files containing mixed newlines git config --global core.safecrlf true #Allow submission of files containing mixed newlines git config --global core.safecrlf false #Give warning when submitting files containing mixed newlines git config --global core.safecrlf warn
Thank you for reading! About "how to solve the AutoCRLF and SafeCRLF newline problem in Git" this article is shared here, I hope the above content can be of some help to everyone, so that everyone can learn more knowledge, if you think the article is good, you can share it to let more people see it!