Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/362.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Git clean不删除文件_Git - Fatal编程技术网

Git clean不删除文件

Git clean不删除文件,git,Git,给我 git reset --hard HEAD 不过,我还是得到了这个 git clean -df Removing "LIFE/uploads/docs/Community_Plan_onlineA\314\203\342\200\240%92.pdf" git状态 #论分行行长 #未为提交而暂存的更改: #(使用“git add/rm…”更新将提交的内容) #(使用“git签出--…”放弃工作目录中的更改) # #删除:“生活/上传/文档/社区计划在线\303\203\342\200

给我

git reset --hard HEAD
不过,我还是得到了这个

git clean -df

Removing "LIFE/uploads/docs/Community_Plan_onlineA\314\203\342\200\240%92.pdf"
git状态
#论分行行长
#未为提交而暂存的更改:
#(使用“git add/rm…”更新将提交的内容)
#(使用“git签出--…”放弃工作目录中的更改)
#
#删除:“生活/上传/文档/社区计划在线\303\203\342\200\240%92.pdf”
#
未向提交添加任何更改(使用“git add”和/或“git commit-a”)
请注意稍有不同的文件名(\u Plan\u online\303而不是\u Plan\u online\314)。
是什么导致此文件粘滞?我正在用core.autocrlf=false打开OSX btw,它并不是真的卡住了-你有一个名为
LIFE/uploads/docs/Community\u Plan\u online\303\203\342\200\240%92.pdf的跟踪(提交)文件。分期删除并提交以将其删除

Git有时会被不区分大小写的文件系统所欺骗。您正在处理两个具有两个不同Unicode字符的文件名,HFS+认为这两个字符大小写等效。Git认为在某些条件下它们是不同的文件,有时认为在其他条件下它们是相同的文件

OS-X默认文件系统不区分大小写,它将文件名存储为(“根据该答案,标准化形式为D”)。因此,我认为“A\314”是HFS+,使用分解的UTF-8表示拉丁语“A”,并带有组合变音符号(上面的反逗号?)。Git报告的“\303”表示带波浪号的拉丁语a。我猜在不区分大小写的文件系统中,这些字母被认为是等价的

在第一个git状态期间,我猜git会检查所有跟踪文件的状态,并且HFS+会报告一个与该文件名大小写等效的文件名。然后Git查找未跟踪的文件,发现一个文件名与跟踪文件列表中的任何文件名都不完全匹配。因此Git只报告一个未跟踪的文件

git status

# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#   "LIFE/uploads/docs/Community_Plan_onlineA\314\203\342\200\240%92.pdf"
nothing added to commit but untracked files present (use "git add" to track)
在第二个git状态期间,git检查所有跟踪文件的状态,HFS+报告没有与文件名匹配的文件。因此Git报告跟踪的文件已被删除。(当然,现在该文件已不存在,因此不会报告为未跟踪文件。)


您没有说您使用的是哪个版本的Git,但是更新版本的Git可能会更好地处理这种情况。

谢谢您的解释。我原以为这与文件名编码有关,但您确实提供了一个很好的问题描述。我们在混合的Windows/Mac环境中工作,因此我怀疑该文件是首先从Windows推送的。顺便说一句,这个问题在最新的git版本1.8.2中仍然存在。
git status

# On branch master
# 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:    "LIFE/uploads/docs/Community_Plan_online\303\203\342\200\240%92.pdf"
#
no changes added to commit (use "git add" and/or "git commit -a")