Make Git "LF will be replaced by CRLF" warnings go away
git
Solution
You can just delete and re-checkout the offending files from the index like this:
rm <files>
git checkout -- <files>
Or, if they are the only modified files (be careful with this command), you can script it like this:
git diff --name-only --diff-filter=M | xargs rm --
git checkout -- .
On a GNU system you can use a slightly safer pipe, but you don't appear to have spaces or other delimiting characters in your filenames in any case.
git diff -z --name-only --diff-filter=M | xargs -0 rm --
Problem
I have setup Git so it doesn't commit inconsistent line endings. The problem with that is a whole pile of files appear modified even though they are not. What do I type to make these files have the line endings fixed on the local side? ``` # git checkout dev M src/au/policy/dao/EmailQueue.java M src/au/policy/dao/EmailQueueFactory.java M src/au/policy/dao/PolicyPublisher.java Already on 'dev' # git diff warning: LF will be replaced by CRLF in src/au/policy/dao/EmailQueue.java warning: LF will be replaced by CRLF in src/au/policy/dao/EmailQueueFactory.java warning: LF will be replaced by CRLF in src/au/policy/dao/PolicyPublisher.java ``` This is what I added to my git config file which seems to do what I intended aside from this issue: ``` autocrlf = true ```