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:

  • find all git commits for a file type
  • File name is too long: how to remove?
  • how to update local repo if some one has made change in master repo?
  • Which version control software allows to whitelist dirs?
  • gitignore does not ignore files
  • Is it possible to ignore git file mode change in my own ~/.gitconfig
  • 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?

  • Can't Push to Git Repository
  • Why no yellow in powershell and posh git
  • Is it possible to add a file to a git repo without having it checked out locally?
  • Git - getting a list of branches that were merged into another branch
  • How to see changelogs for a particular module in kernel
  • Multiple git repositories with 1 main repository
  • One Solution collect form web for “Cannot checkout modified files”

    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”

    Git Baby is a git and github fan, let's start git clone.