【发布时间】:2022-01-10 10:34:53
【问题描述】:
MS Word 确实在打开文件时自动创建了这些文件。我不小心提交了这些文件。关闭 MS Word 后,文件已自动删除。现在 Git 仍然显示文件,我无法删除、添加或签出它们。如何从存储库中删除这些文件?
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
deleted: NonProject/GameObjectSetupInstructions/RaceScene/~$VFX.docx
deleted: NonProject/GameObjectSetupInstructions/RaceScene/~$ceSceneLighting.docx
modified: NonProject/GameObjectSetupInstructions/RaceScene/~$ceSceneSetup.docx
$ git checkout NonProject/GameObjectSetupInstructions/RaceScene/~$VFX.docx
error: pathspec 'NonProject/GameObjectSetupInstructions/RaceScene/~.docx' did not match any file(s) known to git
$ git rm --cached NonProject/GameObjectSetupInstructions/RaceScene/~$VFX.docx
fatal: pathspec 'NonProject/GameObjectSetupInstructions/RaceScene/~.docx' did not match any files
$ git rm NonProject/GameObjectSetupInstructions/RaceScene/~$VFX.docx
fatal: pathspec 'NonProject/GameObjectSetupInstructions/RaceScene/~.docx' did not match any files
【问题讨论】:
-
试试
git add 'NonProject/GameObjectSetupInstructions/RaceScene/~$VFX.docx'? -
成功了!我总是尝试使用“”而不是“”。我认为它是等价的......无论如何,非常感谢。
-
@MasterMax 波浪号
~可能被解释为您的主目录。试试cd ~或cd ~/Documents。
标签: git