GitHub line break Auto-transform feature

Source: Internet
Author: User

Recently want to put their own QT project synchronization to GitHub, but when the code from the warehouse check out when the compilation always appear some very wonderful error, at first thought is the source file encoding problem, changed the code after the problem or did not solve, I compared the two projects in the document, That's a surprise.

Windows line wrapping is \ r \ n, hexadecimal value is: 0D0A.
Linux line break is \ n, hexadecimal value is: 0A

Git is developed by the famous Linus and can only run on the *nix system at first, so it is recommended to store only UNIX-style line breaks. But it also takes into account cross-platform collaboration scenarios, and provides a "line break auto-transform" feature.

This feature is in Auto mode by default, and when you check out a file, it tries to replace the UNIX line break (LF) with the newline character (CRLF) of Windows, and when you commit the file, it tries to replace CRLF with LF. If the file you are on is a UTF-8 file that contains Chinese characters, then this "line break auto-Convert" feature is not working at the time of submission (but there is no problem with conversion processing at checkout)

Usegit config --global core.autocrlf false可以关闭github换行自动转换功能

Or get rid of the. gitconfig file Add Autocrlf = False after [core]

The problem is solved! And you can have a nice code.

GitHub line break Auto-transform feature

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.