Convert line-endings for whole directory tree (Git)

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.

Leave a Comment