After seeing the following from the command line:
# On branch RB_3.0.10
# Changed but not updated:
# (use \"git add ...\" to update what will b
This has been bothering me for a while, almost every repo I'd check out had changes that I couldn't discard. Long story short, I tried all of the above, nothing worked. This is what I did to get things back to normal (on a Mac):
Completely remove the autocrlf & safecrlf settings from ~/.gitconfig
Completely remove the autocrlf & safecrlf settings from your repo's local config ./.git/config
git rm --cached -r .
git reset --hard
Are you on OSX or Windows? If so, the problem probably is having two files of the same name, with different case. eg. index.htm and Index.htm
Windows, and by default OSX, uses a case insensitive file system, which conflicts with the case sensitive git.
My problem is kind of similar here and I just found out that git is tracking the changes in file permission. I tried discarding and resetting the branch but files are still there. Run git config --get --local core.filemode
, if it is true then you need to set it as false to turn off tracking of file permissions. Running git config --local core.fileMode false
should solve it. You can read more here
Here is my experience, set following variables in .git/config
:
[core]
autocrlf = false
safecrlf = false
eol = crlf
then run $ git checkout HEAD .
, and it works. but $ git checkout -- .
not, strange!
* git version 1.9.3
I think you need to pass -f
From the man page (man git-checkout
, GIT-CHECKOUT(1)):
-f, --force
Proceed even if the index or the working tree differs from HEAD.
This is used to throw away local changes.
For instance, discard changes on the current branch and switch to a different branch:
git checkout -f master
I had .gitattributes with the following content:
* text=auto eol=lf
To overcome the issue, edit .gitattributes
to remove this line which relaxes line endings. Then git reset --hard HEAD
reverted the files and .gitattributes
file.