Chris Bier
Chris Bier

Reputation: 14437

Cannot checkout modified files

All of the files in my repository show up as modified in the index. I have no idea how this came about and I have been trying to remove the modified files from the index but I am unable to do so.

I tried the following:

git checkout -- .
git reset --hard HEAD

I've even tried to checkout a file individually, but even so it still shows as modified when I do git status afterwards.

git checkout -- path/to/file.txt

Do you have any ideas as to what is going on?

Upvotes: 2

Views: 1433

Answers (1)

VonC
VonC

Reputation: 1323183

It is possible the files have their end of line changes automatically (check the result of git config core.autocrlf).
I always try to keep that particular setting to false.

You have other automatic changes that can be applied on checkout or reset, i.e. various content drivers declared in a .gitattributes file (like core.eol, or text).

Regarding the permission being changes automatically, try

git config core.filemode false

More details in "Removing files saying “old mode 100755 new mode 100644” from unstaged changes in git"

Upvotes: 2

Related Questions