aliens

Author Topic: Line endings  (Read 5586 times)

Offline karvanit

  • Captain
  • ***
  • Posts: 94
    • View Profile
Line endings
« on: November 09, 2012, 06:48:09 pm »
I have created a branch that set the line endings of files to be managed through Git. (line-endings)
To make sure your line endings are ok, after pulling from it, merging and commiting, delete ALL the files in the working directory (except files under the git directory .git) and do
Code: [Select]
git reset --hardFrom then on, you never have to worry about line endings and huge whitespace changes any more.

This is based on the current SupSupr's master, so you may have many merge conflicts if you have moved a long way from it. But just taking the .gitattributes file from it should help normalize your line endings.

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2162
    • View Profile
Re: Line endings
« Reply #1 on: November 09, 2012, 09:23:53 pm »
I find the best policy for line endings is to just let Git automatically take care of them for you (specially handy for working cross-platform). If you turn on "autocrlf" in the Git settings (see here), then any files you receive will automatically be converted to the line endings of your platform, and any files you send will automatically be converted to whatever Git uses, so everything stays consistent and you don't have to worry about them anymore! :) You can also use "safecrlf" if you want Git to warn you when you accidentally have files with mixed line endings.

Offline karvanit

  • Captain
  • ***
  • Posts: 94
    • View Profile
Re: Line endings
« Reply #2 on: November 09, 2012, 09:44:44 pm »
We should add the core.autocrlf to the coding guidelines, because we have lots of people on different platforms that get bitten by this.

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2162
    • View Profile
Re: Line endings
« Reply #3 on: November 09, 2012, 10:42:22 pm »
Really? Only Windows users would get bitten by this (since Git uses LF internally) and it's in the compiling instructions, though they probably need to be updated with all the stuff people have trouble with.