1

I fixed a file with CRLF issues be using the sed one liner:

sed -i 's/^M//' <filename>

However, this file is not showing up in the git status and the removal of the CR is not showing up in a git diff:

git diff HEAD -- <filename>

Just to make sure this files was not a part of some .gitignore or similar exclusion, I added a newline to the end of the file and was able to see the file in both status and diff.

Is there some config or other setting that is preventing me from seeing the changes where CR was removed? I did go into the file in vi and verify that the CR had indeed been removed successfully (I did do Ctrl-V, Ctrl-M to create the character for the sed one-liner).

Hazok
  • 5,373
  • 4
  • 38
  • 48

1 Answers1

2

I would make sure that core.autocrfl is set to false. Diff will act on what's stored in the repo.

Also, you can inspect the file with vim -b. And you can stream the contents of a file with git show HEAD:path/to/your/file.txt.

Hope this helps.

alex
  • 479,566
  • 201
  • 878
  • 984
Adam Dymitruk
  • 124,556
  • 26
  • 146
  • 141
  • I moved onto a different issue and now that I'm back to the branch it looks okay again. I'm almost wondering if someone was playing with my global config since I tried various versions of autocrlf and had originally had my repo setting to input (on Linux); I haven't pulled since I was looking into this originally. Going to +1 and give this the answer by default since you're the only that's replied :D – Hazok Dec 13 '11 at 23:25