I have been working on my repository for a while but recently received a strange status on one of my files which I will name file.py
(I will also name the current branch as my_branch
). I am not sure what put GIT in this state, but I can seem to fix it (without falling back to cloning the entire project). GIT now seems completely confused with my change and refuses to revert to old changes.
$ rm file.py
$ git reset --hard
HEAD is now at 42d1b0b Documentation for various modules.
$ ls | grep file.py
file.py
$ git status
On branch my_branch
Your branch is up-to-date with 'origin/my_branch'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: File.py
no changes added to commit (use "git add" and/or "git commit -a")
A little note here, the File.py
listed as part of the git status really is capitalized for some reason. The file file.py
was pulled down as lowercase. At this point, I am just frustrated and want to get back to work, so I tried to clean everything.
$ git clean -dxf
// Various files cleaned
$ rm file.py
$ git pull
Already up-to-date.
$ git reset --hard
HEAD is now at 42d1b0b Documentation for various modules.
$ ls | grep file.py
file.py
$ git status
On branch my_branch
Your branch is up-to-date with 'origin/my_branch'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: File.py
no changes added to commit (use "git add" and/or "git commit -a")
It is there yet again! Running git diff file.py
yields differences too. But the differences are the same as my last commit. Attempting to add the file does not help either as it silently ignores my request.
Any suggestions?