When all the members of your team assigned to a project are working on the same OS, everything goes fine, but when they are using different OS such as Linux and Windows, you will surely encounter line endings issues in the different commits, that will degrade comparisons tasks.
The solution by example, if your production server is under linux, is to tell your developers under windows to force Github and their IDE apply “LF” line endings (if you use netbeans, check for “show and change line endings”). We will see here how to force Github using LF line endings on Windows (I assume your IDE is configured to save your files in LF line ending).
First, open your console and type
git config --global core.autocrlf false
Go to Github directory
C:\Program Files (x86)\Git\etc //Give write permissions (if necessary) to these files and open them .gitattributes .gitconfig //In .gitattributes add this line, files you will check will now be normalized * text eol=lf //In .gitconfig, set autocrlf to false if it hasn't been done by the previous command //This option will not set automatically files to Crlf even if in lf before [core] symlinks = false autocrlf = false
Open your console and apply the generalization to Github core
git config --global core.eol lf
Now, every file you will work with, will be cached and committed with LF line endings.
But, maybe you want all your repository and its branches to be updated to correct line endings, right?
Let’s do this, open your console one more time and type this:
//These commands will remove cached files and normalise the current repo branch git rm --cached -rf . git diff --cached --name-only -z | xargs -0 git add . //these ones will normalize all the repo branches git ls-files -z | xargs -0 rm git checkout .
That’s all, you will no more have line endings issues in your project.
On the other side, make sure that new developers integrating your team will follow this process.
PS: If no changes appear, reclone your repository.
Good work guys.