Warning: LF would be replaced by CRLF fixed by dos2unix

If you work with the version control system git, and you work with people that use a multitude of development environments and operating systems, you are bound to run across the warning, “LF would be replaced by CRLF.”

There are many ways to fix this, but my favorite is a utility called dos2unix. You feed the command line utility the file to convert and dos2unix does the rest. If you are using homebrew on the mac you can run

brew install dos2unix

Other operating systems support the utility as well, the Windows app store even has a dos2unix utility.

Once you have it setup you simply pass the offending file to the utility and then proceed on with your day.

dos2unix config.rb

You can pass it multiple files if you wish to do batch conversion. Once you receive no more warnings you can continue on with a git commit.

Leave a Reply

Your email address will not be published. Required fields are marked *