无法删除git中的文件

时间:2014-08-29 17:57:05

标签: git unicode

我对包含unicode字符的文件有一些奇怪的行为:

Spécifications fonctionnelles v1.4.pdf

我不知道发生了什么,但是几个小时后我就收到了以下git状态消息:

$ git status
On branch master
Your branch is ahead of 'origin/master' by 4 commits.
  (use "git push" to publish your local commits)

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:    "doc/fr/Sp\351cifications fonctionnelles v1.4.pdf"

no changes added to commit (use "git add" and/or "git commit -a")

该文件尚未存在,如果我尝试删除它,我有以下列表:

       deleted:    "Sp\303\251cifications fonctionnelles ERytmo v1.4.pdf"
       deleted:    "Sp\351cifications fonctionnelles ERytmo v1.4.pdf"

我怀疑编码发生了变化,但我的问题不存在,我只想清理我的存储库状态,但git reset --hard HEAD无效。

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

尝试git diff --name-only --diff-filter=D -z | xargs -0 git rm --cached

取自here。 &#34;如果您真正想要做的就是从索引中删除工作树中不再存在的文件(可能是因为您的工作树是脏的,因此您不能使用git commit -a),请使用以下命令命令&#34; ^

相关问题