Norswap Norswap - 1 year ago 188
Git Question

Unstaged changes left after git reset --hard

Titles says it all.


git reset --hard
git status
gives me files within the
Changes not staged for commit:

I've also tried
git reset .
git checkout -- .
git checkout-index -f -a
, to no avail.

So how can I get rid of those unstaged changes ?


This seems to hit only Visual Studio project files. Weird. See this paste: . What is special with those files is that in .gitattributes I have:

*.sln eol=crlf
*.vcproj eol=crlf
*.vcxproj* eol=crlf

is set to false in my global
is that would be somehow relevant.

Answer Source

Okay, I've kind of solved the problem.

It seemed that the .gitattributes file, containing:

*.sln        eol=crlf
*.vcproj     eol=crlf
*.vcxproj*   eol=crlf

made the project files appear unstaged. I am clueless why that is, and I'm really hoping that someone privy to the ways of git will give us a nice explanation.

My fix was to remove these files, and to add autocrlf = false under [core] in .git/config.

This does not amount to exactly the same thing as the previous configuration, as it requires every dev to have autocrlf = false. I'd like to find a better fix.


I commented the incriminating lines, uncommented them and it worked. What the ... I don't even ... !