Torsten Bögershausen <tbo...@web.de> writes:

> The following would solve your problem:
>    git init
>    echo $'dos\r' > dos
>    git add dos
>    git commit -m "dos newlines"
>    echo "dos -crlf" > .gitattributes
>    git add .gitattributes
>    git commit -m "add attributes"
>    echo "dos eol=crlf" > .gitattributes

>    git read-tree --empty   # Clean index, force re-scan of working directory
>    git add dos

This is not advisable as a general suggestion, as in a real life (as
opposed to a toy example) there will be paths other than this 'dos'
thing in the working tree.  Perhaps replace "git read-tree --empty"
with "git rm -f --cached dos" or something like that that limits its
damage would prevent mistakes better.

>    git add .gitattributes
>    git commit -m "set eol attribute instead"
>    git ls-files --eol

Reply via email to