How to make Git ignore different line endings

warning: CRLF will be replaced by LF in [filename].
The file will have its original line endings in your working directory.

Getting errors like these, and want to deliberately ignore them?

If you don’t know why you would, you should read this great blogpost about line endings in Git by Tim Clem.

Don’t look at line endings!

In some cases you want to ignore these errors. In my specific situation i don’t want Git to warn me about the line endings, because my IDE takes care of that. I work in a project with multiple people, and somewhere in the process some files with different line endings than the project standard slipped into the repo. It happens. Your Git could be configured so that it automatically corrects the file line endings for you when you pull this code.  And this can be pretty annoying.

You can change this behaviour, but again, to avoid problems you have to know the reason why you get these errors. Be sure you know, see the link earlier in this post.

You can disable the CRLF behaviour completely, or per filetype by changing entries in your .gitattributes file. In my case, i put this:

* -crlf

This tells git to ignore the line endings for all files. And does not change the files in your working directory. Even if you have the core.autocrlf set to true, false, or input.

Using a PHP IDE: The start of a journey

So this week i’ve started the epic journey of setting up an environment to make full use of an integrated development environment for PHP.

Now using version control, develop locally, debugging, auto code-completion etc. is something i’ve heard a lot of people talk about lately.
Not because it’s a hot-topic, but because it’s mandatory for every (PHP) developer that wants to make full use of his or hers creative mind. Yes that’s right, what i considered first to be “Overhead” like version control seems to be mandatory for making your life as a developer easier.

As my day to day job requires me to work with several developers directly on a FTP server, i was never able to use a PHP IDE to it’s full extent. Things like debugging, auto code completion, version merging do not seem to be possible with *any* PHP IDE when you work directly onto a FTP server. So this has to change. And besides, this leads to a lot of problems which i probably don’t even have to explain.

Now that i am becoming more interested in Open Source development i have to do some research on how to set this all up.
Which is exactly what i am going to do this weekend.

There are a couple of problems i ran into before even starting to set things up. I still have to think of a solution to these:

  • Database version control
  • Automatic deployment
  • Merging feature branches to the testing/staging/live branches

Probably how to handle database version control concerns me the most, have to read up on that a bit more.

PS: Any idea’s, tips or tricks are welcome, as i am fairly new to all of this!