Following situation:
I'm working on a Mac running OS X and recently joined a project whose members so far all use Windows. One of my first tasks was to set up the codebase in a Git repository, so I pulled the directory tree from FTP and tried to check it into the Git repo I had prepared locally. When trying to do this, all I got was this
fatal: CRLF would be replaced by LF in blog/license.txt.
Since this affects all files below the "blog" folder, I'm looking for a way to conveniently convert ALL files in the tree to Unix line-endings. Is there a tool that does that out of the box or do I get scripting something myself?
For reference, my Git config concerning line-endings:
core.safecrlf=true
core.autocrlf=input
dos2unix does that for you. Fairly straight forward process.
dos2unix filename
Thanks to toolbear, here is a one-liner that recursively replaces line endings and properly handles whitespace, quotes, and shell meta chars.
find . -type f -exec dos2unix {} \;
If you're using dos2unix 6.0 binary files will be ignored.