I have a modified file which I want to rever to whatever is in the latest commit but it's "stuck" there always being marked as modified.
$ git status
# On branch master
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: index.php
#
no changes added to commit (use "git add" and/or "git commit -a")
I then try:
$git checkout -- index.php
But the output of git status is still the same. I then try:
$git reset --hard master
HEAD is now at 02c9613 test commit message
And the output of git status is STILL the same.
Any ideas on how I can get rid of the supposed changes on that file?
git diff. It smells like stackoverflow.com/search?q=[git]+autocrlf.Subproject commit hash1toSubproject commit hash2, it means you have a submodule in your project and you need to update it. In this case, dogit submodule foreach git pull. If it now sayshash1changed tohash3, go into the submodule folder (the "file") and dogit checkout hash1. There are also other ways to do the submodule update, but this worked for me.