Question

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).

Était-ce utile?

La solution

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top