I'm quite inexperienced with Git, and this one baffles me:
I just switched my working copy to another branch (a simple git checkout master
), and immediately after that, git status
tells me about hundreds of changed files. However, it's all about line endings; a git diff --ignore-space-at-eol
gives me a lot of warnings:
warning: CRLF will be replaced by LF in src/.../somefile.js.
The file will have its original line endings in your working directory.
I generally consider it a bad idea to have DOS-style line endings in versioned text files, but this is what they have been committed like in the first place; I did this in a Linux box, and the files I got have CRLF line endings.
What is the best way to clean up in my situation? Should I change the line ending of every single file and commit this?
How can Git be configured to avoid such situations in the future?
core.autocrlf
setting. This question has a great answer that might assist you in deciding whether or not that option is for you. – Kedah