search

Home  >  Q&A  >  body text

Problems that occur when pulling requests on github.

I forked a copy first and then changed one of the files.
The screenshot below appeared during the pull request. Why is this happening?
I only changed line 16. Why does the entire file appear to be different when comparing the files when only one line is changed?

習慣沉默習慣沉默2813 days ago632

reply all(2)I'll reply

  • 世界只因有你

    世界只因有你2017-05-02 09:32:24

    It may be a space and tab conversion problem, depending on some settings of the development tools you use

    reply
    0
  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-02 09:32:24

    • windows uses CRLF two characters, line break

    • *Unix and Mac use LF newline by default

    So after your windows machine saves the modification, it will automatically change the LF 改为 CRLF in the file to

    The solution is as follows:

    Git can automatically convert the line terminator CRLF to LF when you commit, and convert LF to CRLF when checking out the code. Use core.autocrlf to turn on this feature. If you are on a Windows system, set it to true so that when checking out the code, LF will be converted to CRLF:

    $ git config --global core.autocrlf true

    Linux or Mac systems use LF as the line terminator, so you don’t want Git to automatically convert it when checking out the file; when a file with CRLF as the line terminator is accidentally introduced, you definitely want to correct it and change core. Set autocrlf to input to tell Git to convert CRLF to LF when committing, but not when checking out:

    $ git config --global core.autocrlf input

    This will preserve CRLF in checked out files on Windows systems, and LF on Mac and Linux systems, including repositories.

    If you are a Windows programmer and are developing projects that only run on Windows, you can set false to cancel this function and record the carriage return character in the library:

    $ git config --global core.autocrlf false

    You can refer to the official Chinese documentation🎜

    reply
    0
  • Cancelreply