git - 排除嵌套文件夹的 gitignore 模式是什么?

标签 git gitignore

我的项目中有以下文件夹:

/wwwroot/lib/blue-imp-fileupload
/wwwroot/lib/jquery
/wwwroot/lib/foundation-sites
/wwwroot/lib/font-awesome
/wwwroot/lib/daily/dist

并且想要忽略除/wwwroot/lib/daily/dist 以及任何子文件夹和文件之外的所有文件夹。实现这一目标的 gitignore 模式是什么?

最佳答案

我在这里找到答案:.gitignore exclude folder but include specific subfolder

在您的.gitignore中,添加:

wwwroot/*
!wwwroot/lib/
wwwroot/lib/*
!wwwroot/lib/daily/
wwwroot/lib/daily/*
!wwwroot/lib/daily/dist/

关于git - 排除嵌套文件夹的 gitignore 模式是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42521667/

相关文章:

与 VS 2012 项目文件相关的 Git 问题

git - "git stash -A"如何排除.gitignore内容?

git - 什么是 git稀疏 checkout 以及它在什么情况下有用?

git - 没有有效的源代码控制提供程序

由于图标,Git 忽略图标文件?规则

VB.NET 项目的 Git 忽略文件

Git:忽略版本控制文件

django - 你如何使用 git 在 django 上管理你的 fork 可重用应用程序

git - 将内容从 GitHub 移动到 JsDelivr 有哪些步骤?

git - 如何 checkout 到另一个分支并强行覆盖更改