git and line endings

Hi,

What settings should one have for line endings in git and ones IDE?

I noticed that some files (Phoenix) have "LF" some have "CRLF"

Using WingIDE, should I just set the project settings as:
Preferred Line Ending - Use Preference Settings (which is "CRLF" by default as I am on Windows)
Line Ending Policy - Ignore conflicts

Or should I use:

git config --global core.autocrlf true

https://help.github.com/articles/dealing-with-line-endings/

Or is there a better/saner way of setting things up?

Werner

Werner wrote:

Hi,

What settings should one have for line endings in git and ones IDE?

I noticed that some files (Phoenix) have "LF" some have "CRLF"

Using WingIDE, should I just set the project settings as:
Preferred Line Ending - Use Preference Settings (which is "CRLF" by
default as I am on Windows)
Line Ending Policy - Ignore conflicts

Or should I use:

git config --global core.autocrlf true

Configuring Git to handle line endings - GitHub Docs

Or is there a better/saner way of setting things up?

You might want to try setting autocrlf to "input" as that will keep them in whatever format they have in the repository. There are a few files in the wxWidgets repo (but on any in Phoenix that I recall) that must always be in CRLF mode. But if you are using a smart editor that can handle either style then it doesn't matter too much what format the rest of the source files are using. IIRC, the "input" style also intelligently converts newly added text files to LF when they are committed the first time.

···

--
Robin Dunn
Software Craftsman

Robin Dunn wrote:

You might want to try setting autocrlf to "input" as that will keep them
in whatever format they have in the repository. There are a few files in
the wxWidgets repo (but on any in Phoenix that I recall) that must

That should be: ...but not* any...

···

--
Robin Dunn
Software Craftsman

...

You might want to try setting autocrlf to "input" as that will keep them in whatever format they have in the repository. There are a few files in the wxWidgets repo (but on any in Phoenix that I recall) that must always be in CRLF mode. But if you are using a smart editor that can handle either style then it doesn't matter too much what format the rest of the source files are using. IIRC, the "input" style also intelligently converts newly added text files to LF when they are committed the first time.

Found this doc:
http://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration

Based on above and as I am on Windows I think I need "true". Did a quick test on the Phoenix repo, after setting the config I did a new clone of the repo and the files WingIDE warned me about don't give me a warning and as git converts back to 'LF' when I push the repo should be fine too.

Werner

···

On 2/12/2015 20:08, Robin Dunn wrote: