2

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?

Chris Bier
  • 14,183
  • 17
  • 67
  • 103

1 Answers1

2

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"

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • This. HUGE PITA when switching between multiple OSes/environments. – Nick Tomlin Apr 15 '13 at 20:50
  • @NickTomlin yes, which is why I try to set that `core.autocrlf` always to false. – VonC Apr 15 '13 at 20:52
  • Thanks, I changed `autocrlf` to false and tried to checkout the modified files but to no avail. I also have nothing set for `core.eol` or `text`. Do you have any other ideas? – Chris Bier Apr 15 '13 at 20:54
  • @ChrisB the `checkout` won't be enough: a `git reset --hard HEAD` would be better. – VonC Apr 15 '13 at 20:54
  • @VonC I forgot to mention that I tried `git reset --hard HEAD` as well but my index still has all of the modified files in it :( – Chris Bier Apr 15 '13 at 20:56
  • @ChrisB then this is caused by another setting. Can you share a bit of the `git status`, as well as a `git diff -- aFile`? – VonC Apr 15 '13 at 20:57
  • @VonC The git status is about 1k lines, what part of it would you like to see? As for the git diff: `old mode 100755 new mode 100644` – Chris Bier Apr 15 '13 at 21:02
  • @ChrisB ok, answer edited (a `git reset --hard HEAD` is still needed) – VonC Apr 15 '13 at 21:07