运行 Windows 7 并从Git-1.8.3-preview20130601.exe
.
我的工作目录中有一个修改过的文件,我想将它恢复到上次提交时的状态。我尝试了各种调用git checkout
,但修改后的文件仍保留在我的工作目录中。例如:
[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>
(我得到相同的结果git checkout -- pomodoro.html
。)
所以,git 认为 pomodoro.html 被修改了,但是当我使用
git difftool
我被告知文件是相同的。
不知道它是否相关,但我已经在我的 Git 配置中core.autocrlf
设置了。true
但是,当我将其更改为时,false
我得到了相同的行为。