Gitignore 不会忽略特定文件夹

标签 git gitignore

我已将此文件添加到我的 gitignore 文件

public/file/*

当我执行 git status 时,我仍然看到

new file:   public/file/external/description.txt
new file:   public/file/external/header.txt

如何让 git 忽略 public/file/ 中的所有内容? 怎么阻止呢?

我需要清除任何缓存吗?

最佳答案

您应该能够通过

来完成此操作
public/file/**

从文档中,** 表示任意数量的子目录

我认为专门忽略目录而不是其中的对象也可以

public/file/

关于Gitignore 不会忽略特定文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35296965/

相关文章:

ruby-on-rails - rails : vendor/gems or vendor/plugins?

git - 我在哪里可以找到实现的耐心差异?

git - 为什么 visual studio 在我的 .gitignore 文件中提交文件?

xcode - Git 忽略 xcodeproj 文件

reactjs - touch .gitignore 不创建文件

Git 子模块 : Is it possible to have more than one URL for each?

git - 重写 git 历史以使 crlf 保持一致

git - Visual Studio 忽略 gitIgnore 文件中的 *.jfm 条目

git - 从 IntelliJ IDEA 的版本控制中删除文件

Git(源树): gitignore already tracked files without deleting from online repository