Reputation: 171
Problem: Git is interpreting an entire C# file as modified after saving file changes locally. It is indicating that line endings have changed, even though they were checked out as CRLF endings and saved locally with CRLF line endings.
I am working on a Visual Studio project at my job that has multiple contributors. I am using Visual Studio 2012. For the past 2 days, another colleague and I have been experienced the above issue after cloning the repo from our corporate Stash site. We cannot commit our changes because Git indicates that the entire file has changed and some of our files are thousands of lines long. Here is more context around the symptoms:
git checkout --
git reset --hard
git reset HEAD
git stash
Here is a list of the steps I have taken to attempt fixing the issue:
autocrlf=true
and autocrlf=false.
This is documented here. The issue remains under both settings * text=auto
*.cs text
Nothing I have done so far has fixed the issue. My hunch is that it is related to the settings in the .gitattributes file. However, no one else, including the main developer on the project, have experienced these issues when cloning the repo. I would greatly appreciate any suggestions. Thanks!
Upvotes: 16
Views: 3658
Reputation: 106
I had the same problem and commented out the line
* text=auto
in .gitattributes.
That solved my problem. Hope this helps you or anyone else with the same problem.
From what I understand the * text=auto
line is supposed to help with line endings but for some reason a bunch of people running windows seem to have a problem with it.
Upvotes: 7