Jump to content

Git, Windows, Linux, and end of line


NotionCommotion

Recommended Posts

My IDE (Nusphere's PhpED) runs on Windows but is configured so that both the web server as well as all project files are located on a development Linux server. Since the project files are located on the Linux server, the git repository is located there as well and not on my PC.  Every now again, my IDE complains that content was externally modified and whether I wish to reload the file.  Also, I was recently asked to set git's core.autocrlf to true on a project I was collaborating on which prevented me from adding any changes to git (git complained that LF will be replaced by CRLF).

The IDE allows file encoding to be changed (system default, UTF-8, Windows-1252, or ISO-8859-01) as well as the default file format (Unix, Windows, Mac, or autodetect).

Any recommendations on how best to configure git and these ide settings?

Thanks

Link to comment
Share on other sites

Reminder that when core.autocrlf controls when Git converts line endings:
- true = CRLFs in your working directory, LFs in the repository
- input = whichever in your working directory, LFs in the repository
- false = no conversions

For the project you were contributing towards, if they asked for core.autocrlf=true then they want LFs in their code. That means you need either the "true" or "input" settings, depending whether you care about having CRLFs in your working directory. That's only ever useful if you want to open or edit a file in a dumb editor - which used to be Notepad, but since the October update that's finally no longer the case. So I would use core.autocrlf=input - LFs normally but with graceful handling of CRLFs.

If you're the only developer then it doesn't really matter, but most people use LFs.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.