为什么gnt无法忽略我的子目录?

时间:2014-03-03 19:45:46

标签: windows git gitignore

我的.gitignore文件

ext/templates_c

我的git状态调用

D:\Development\online\site\newsite>git status
# On branch master
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       modified:   ext/pages/config.php
#       modified:   ext/templates_c/60a4cccd667e8b1e3a702b2a2c9108f056837adc.file.pages.html.php
#       modified:   ext/templates_c/fd38ffaa13c6f4c29772bec22cad5aebb1d4d7f6.file.form.html.php
#
no changes added to commit (use "git add" and/or "git commit -a")

我做过一些非常愚蠢的事吗?

为什么gnt无法忽略ext / templates_c中的文件

2 个答案:

答案 0 :(得分:1)

git status将“已忽略”子目录中的文件显示为“已修改”这一事实意味着这些文件已被git跟踪。因此,仅将目录添加到.gitignore不足以使这些文件被忽略(尽管该目录中的新文件将被正确忽略)。您需要为该目录​​中当前跟踪的每个文件执行git rm --cached <file>

答案 1 :(得分:0)

当我写这篇文章时,我发现了

 ext/templates_c

不起作用,但

ext\templates_c

确实

所以你需要使用Windows斜杠。