The most common is the difference between Linux and win line breaks, under Linux the newline character is \ n, but the line break in win is \ r \ n. In other words, if all the files under Linux are copied directly to win, then all the lines are changed into one line, and the file under the Linux will become a ^m behind each line.
Git takes this into account, and there's an option for Git to check out the code on the code base, and if it's on win, it's automatically \ r \ n. Then, when the code is submitted, the \ r \ n is converted to \ n. The line break in the code base is always \ n. Other people do not have to convert the code in the code base when they check it out to Linux.
Look at the configuration of your git first:
git config--global core.autocrlf
If true, the delegate is converted to \ n at commit, and the check-out is converted to \ r \ n.
git config Autocrlf
#提交时转换为LF, converted to CRLF when checked out
git config--global core.autocrlf true
#提交时转换为LF, do not convert when checking out
git config--global core.autocrlf input
#提交检出均不转换
git config--global core.autocrlf false
Safecrlf
#拒绝提交包含混合换行符的文件
git config--global core.safecrlf true
#允许提交包含混合换行符的文件
git config--global core.safecrlf false
#提交包含混合换行符的文件时给出警告
git config--global Core.safecrlf warn
Original: http://blog.csdn.net/hongchangfirst/article/details/43987253
Author: Hongchangfirst
Hongchangfirst's homepage: http://blog.csdn.net/hongchangfirst
Three minutes to teach you to learn Git (vii) cross-platform collaboration