Three minutes to teach you to learn Git (vii) cross-platform collaboration

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.