qwertymk qwertymk - 14 days ago 6
Git Question

How to change line-ending settings

Is there a file or menu that will let me change the settings on how to deal with line endings?

There are 3 options:


  1. Checkout Windows-style, commit Unix-style line endings
    Git will convert LF to CRLF when checking out text files. When
    committing text files, CRLF will be converted to LF. For
    cross-platform projects, this is the recommended setting on Windows
    ("core.autocrlf" is set to "true")

  2. Checkout as-is, commit Unix-style line endings
    Git will not perform any conversion when checking out text files.
    When committing text files, CRLF will be converted to LF. For
    cross-platform projects this is the recommended setting on Unix
    ("core.autocrlf" is set to "input").

  3. Checkout as-is, commit as-is
    Git will not perform any conversions when checking out or committing
    text files. Choosing this option is not recommended for cross-platform
    projects ("core.autocrlf" is set to "false")


Answer

The normal way to control this is with git config

For example

git config --global core.autocrlf true

For details, scroll down in this link to Pro Git to the section named "core.autocrlf"


If you want to know what file this is saved in, you can run the command:

git config --global --edit

and the git global config file should open in a text editor, and you can see where that file was loaded from.