我想将一个文件恢复到上次提交的版本,但在签出后它仍然显示为已修改。
这是之前的情况:
$ git status
On branch master
Your branch is up to date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: doc/slides/slides.pdf
...
然后我想恢复它:
$ git checkout doc/slides/slides.pdf
Updated 1 path from the index
之后仍然显示为修改后的
$ git status
On branch master
Your branch is up to date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: doc/slides/slides.pdf
...
我甚至试图删除它并使用Git再次检查它,但它仍然显示为已修改。git diff
说:
Binary files a/doc/slides/slides.pdf and b/doc/slides/slides.pdf differ
我使用预提交(与钩子)和DVC。但我怀疑这在这里不会有什么不同。
好吧,这真的很愚蠢。与Git无关。
我仍然有pdflatex运行在后台与文件监视器没有注意到它。所以每次我还原它的时候,PDF都会被重新创建。