Running Windows 7 with Git installed from Git-1.8.3-preview20130601.exe
.
I have a modified file in my working dir, I'd like to restore it to its state at the last commit. I have tried various invocations of git checkout
, but the modified file remains in my working dir. For example:
[C:\Work\BitBucket\proj1] 14:32:45>git status
On branch work2
Your branch is behind 'origin/work2' by 9 commits, and can be fast-forwarded.
(use "git pull" to update your local 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: pomodoro.html
no changes added to commit (use "git add" and/or "git commit -a")
[C:\Work\BitBucket\proj1] 14:32:53>git checkout pomodoro.html
[C:\Work\BitBucket\proj1] 14:33:00>git status
On branch work2
Your branch is behind 'origin/work2' by 9 commits, and can be fast-forwarded.
(use "git pull" to update your local 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: pomodoro.html
no changes added to commit (use "git add" and/or "git commit -a")
[C:\Work\BitBucket\proj1] 14:33:04>
(I get the same result with git checkout -- pomodoro.html
.)
So, git thinks pomodoro.html is modified, but when I use
git difftool
I'm told the files are identical.
Don't know if it's relevant, but I have core.autocrlf
set to true
in my Git config. When I changed it to false
I got the same behavior, though.
This link (provided by AD7Six) -- help.github.com/articles/dealing-with-line-endings -- seems to be the answer: fix up the line endings.
Since autocrlf has been set to true, not sure how the line endings in that one file got messed up.
Thanks for all the other comments.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With