I have cloned a git repository on Windows and noticed that the line endings are set to UNIX style (LF).
To fix it, I changed the repository's autocrlf value to true (core.autocrlf=true).
However, all of my checkout out files on disk are still have UNIX style (LF) line returns. How can I fix them?
WARNING: Performing the below commands will cause you to lose any uncommitted changes.
To fix the line endings on your checked out files you will need to issue two commands:
git rm --cached -r . This removes everything from git's index.git reset --hard HEAD This resets all local changes.If you have pending changes, the task becomes much more difficult.
You can use the dos2unix command that comes with msysgit to try fix and the line endings on the files you're trying to commit.
Once you have managed to commit any changes you need to preserve, you can use the two above mentioned commands to reset the line endings for all the files in the respository.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With