Jump to content

Git, Windows, Linux, and end of line

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?


Share this post

Link to post
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.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


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.