Configuring line endings

suggest change

Description

When working with a team who uses different operating systems (OS) across the project, sometimes you may run into trouble when dealing with line endings.

Microsoft Windows

When working on Microsoft Windows operating system (OS), the line endings are normally of form - carriage return + line feed (CR+LF). Opening a file which has been edited using Unix machine such as Linux or OSX may cause trouble, making it seem that text has no line endings at all. This is due to the fact that Unix systems apply different line-endings of form line feeds (LF) only.

In order to fix this you can run following instruction

git config --global core.autocrlf=true

On checkout, This instruction will ensure line-endings are configured in accordance with Microsoft Windows OS (LF -> CR+LF)

Unix Based (Linux/OSX)

Similarly, there might be issues when the user on Unix based OS tries to read files which have been edited on Microsoft Windows OS. In order to prevent any unexpected issues run

git config --global core.autocrlf=input

On commit, this will change line-endings from CR+LF -> +LF

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents