Force LF eol in git repo and working copy

I have a git repository hosted on github. Many of the files were initially developed on Windows, and I wasn’t too careful about line endings. When I performed the initial commit, I also didn’t have any git configuration in place to enforce correct line endings. The upshot is that I have a number of files with CRLF line endings in my github repository.

I’m now developing partially on Linux, and I’d like to clean up the line endings. How can I ensure the files are stored correctly with LF on github, and have LF in my working copy?

I’ve set up a .gitattributes file containing text eol=LF; is that correct? With that committed and pushed, can I just rm my local repo and re-clone from github to get the desired effect?

4 Answers
4

Leave a Comment