Home > open-source, PlanetCDOT, programming > core.autocrlf



I just finished tearing apart my git repo and putting it back together. The reason for this undertaking was that a number of lf/crlf EOL errors had crept into my commits somehow. The culprit, as I found out yesterday, was git config’s core.autocrlf configuration option. Initially, it was set to true, meaning that files checked out from a repo are translated from lf to crlf and files committed back in are translated from crlf back to lf. Problem is, I had some files that needed to be checked out as lf in another repository. Foolishly, I set core.autocrlf to false globally. This set in motion a set of events that led to some of my files in the paladin repo being checked in with all the line endings set to crlf. As you may guess, this absolutely destroys any chance of a meaningful review diff being produced. Clearly, this was my fault and I had to own upto it.

This is when I set out to export my commits to patches, clean up the line endings in the patches, remove any nit-picky changes ( ie a change hunk where only trailing whitespace was removed ), shove the changes back into my repo, updated the old branch pointer to look at my shiny new commits, forced github to forget my old history and finally my repo was sanitized.

What I’ve learned from this is to not let anyone or any thing handle things like line endings for me in the future as I may blow it up inadvertently while trying to do something unrelated. core.autocrlf will stay permanently set to false. The solution? My favourite text editor is now set to produce lf line endings by default; let the chips fall as they may.


  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: