Git was designed to manage large projects, with programmers distributed along the world and working over different platforms. You are probably aware that different platforms represents the end of line with different codes, so, in order to avoid issues comparing files, Git supports a configuration to convert automatically Windows to Linux representation on storing data and Linux to Windows representation on getting data.
In general, it is great, but some package managers like nuget, require to keep some files without modifications, so it becomes into a problem worst than the original one.
Our recommendation is to keep line ending by default by this configuration in gitconfig
file (see more:
[core]
autocrlf = false
safecrlf = false
The property safecrlf = false
is to avoid warning errors converting line endings in the files that we choose to convert automatically.
And allow to convert only certain kind of files by gitattributes
file (see more):
# Set default behaviour, in case users don't have core.autocrlf unset.
* -text
# These files are text and should be normalized (convert crlf => lf)
*.cs text diff=csharp
*.xaml text
*.csproj text
*.sln text
*.msbuild text
*.md text
To be sure that some files (commonly included in the packages) are not touched we recommend to specify it:
# These files should not be normalized
*.js -text
*.css -text
*.less -text
You can see a .gitattributes
file example in our GitHub repository.
More information
You can read more about this issue and other ways to deal with it in the follow links: