Skip to content

Instantly share code, notes, and snippets.

@fabriciorsf
Created July 19, 2024 00:38
Show Gist options
  • Save fabriciorsf/a267a8d5fae669046a1e8a11bf90e5fa to your computer and use it in GitHub Desktop.
Save fabriciorsf/a267a8d5fae669046a1e8a11bf90e5fa to your computer and use it in GitHub Desktop.
#!/bin/bash
sudo apt install dos2unix
git -c core.quotepath=off ls-files --eol \ # query git
| awk '/\/crlf/' \ # filter only lines starting with i/crlf
| cut -f2 / # filter files only (see why it is TAB-delimited https://git-scm.com/docs/git-ls-files#_output)
| xargs -I{} dos2unix {} # convert CR/LF to LF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment