Unstaged changes left after git reset

The title says it all.

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

I've also tried git reset . , git checkout -- . and 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: http://pastebin.com/eFZwPn9Z. What is special with those files, is that in .gitattributes I have:

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

Also, autocrlf is set to false in my global .gitconfig . Could that be somehow relevant?


I had the same problem and it was related to the .gitattributes file. However the file type that caused the problem was not specified in the .gitattributes .

I was able to solve the issue by simply running

git rm .gitattributes
git add -A
git reset --hard

Git won't reset files that aren't on repository. So, you can:

$ git add .
$ git reset --hard

This will stage all changes, which will cause Git to be aware of those files, and then reset them.

If this does not work, you can try to stash and drop your changes:

$ git stash
$ git stash drop

RESOLVED!!!

I have resolved this problem using following stpes

1) Remove every file from Git's index.

git rm --cached -r .

2) Rewrite the Git index to pick up all the new line endings.

git reset --hard

Solution was part of steps described on git site https://help.github.com/articles/dealing-with-line-endings/

链接地址: http://www.djcxy.com/p/9824.html

上一篇: 无法将存储应用于工作目录

下一篇: git重置后留下未更新的更改