Wednesday, October 21, 2015

Git Line Endings

When editing a text file in Windows, the operating system inserts two characters: carriage return and a line feed (AKA CRLF).  In any other operating system, only the LF character is added.  Because some projects are developed collaboratively on different operating systems. Obviously, this poses problems.  Git offers different configurations to deal with this.  With one configuration, Git will automatically replace CRLF with LF upon a commit.  I was stuck with this configuration one day because I believe I mistakenly told it to set it up that way during installation.  You don't want this if you do all your developing in Windows.  To turn this off, use this command:

git config --global core.autocrlf false

No comments:

Post a Comment