Git在被忽略的目录中看到已更改的文件,但不报告它

Git在被忽略的目录中看到已更改的文件,但不报告它,git,gitignore,Git,Gitignore,Git不允许我在干净的工作目录中切换分支。相反,它告诉我被忽略文件夹中的文件将被覆盖 $ git status # On branch ECP-2229 nothing to commit (working directory clean) $ git checkout ECP-2243 error: The following untracked working tree files would be overwritten by checkout: c.t.e.server

Git不允许我在干净的工作目录中切换分支。相反,它告诉我被忽略文件夹中的文件将被覆盖

$ git status
# On branch ECP-2229
nothing to commit (working directory clean)

$ git checkout ECP-2243
error: The following untracked working tree files would be overwritten by checkout:
        c.t.e.server.logback/bin/logback.xml
Please move or remove them before you can switch branches.
Aborting
此工作目录中的此bin/文件夹和其他bin/文件夹中有数百个文件,所有这些文件都被忽略

$ cat .gitignore
bin
我假设该文件已经被跟踪,并试图将其删除,但

$ git rm c.t.e.server.logback/bin/logback.xml
fatal: pathspec 'c.t.e.server.logback/bin/logback.xml' did not match any files

这个文件有什么问题,我怎样才能让git相信它不重要呢?

出于某种原因,有人跟踪了
logback.xml
,而您拥有这个文件的未跟踪版本。所以git警告您未跟踪的版本将被checkout覆盖,这很好,即使它位于
.gitignore
(谁知道它不包含值?)

您无法
git-rm
它,因为您的文件未经跟踪,git不知道,
git-rm
仅对跟踪或暂存的文件有效


相反,只要
rm
it,您就会没事。

出于某种原因,有人跟踪了
logback.xml
,而您拥有此文件的未跟踪版本。所以git警告您未跟踪的版本将被checkout覆盖,这很好,即使它位于
.gitignore
(谁知道它不包含值?)

您无法
git-rm
它,因为您的文件未经跟踪,git不知道,
git-rm
仅对跟踪或暂存的文件有效

相反,只要
rm
it,你就会没事的