在已经gitignored的目录中的一个特定目录中排除git ignore [英] Exclude git ignore on one particular directory inside an already gitignored directory

查看:129
本文介绍了在已经gitignored的目录中的一个特定目录中排除git ignore的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的gitignore文件目前如下所示:

My gitignore file currently looks like the following:

# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
**/wwwroot/lib/
**/wwwroot/_references.js
**/wwwroot/app/**/*.js*
**/wwwroot/css/**/*.min.css
**/wwwroot/js/**/*.min.js
**/wwwroot/bundles/**/*.bundle.min.js

基本上我想忽略 wwwroot / lib / 目录中的所有文件,但lib中的特定目录除外: / wwwroot / lib / file-tester

Basically I want to ignore all files within the wwwroot/lib/ directory with the exception of a particular directory within lib: /wwwroot/lib/file-tester

如何使用 .gitignore 来做到这一点?我已阅读感叹号语法,但它不起作用,可能是由于忽略的顺序。我试过它,如下所示:

How can I do this with .gitignore? I've read about the exclamation mark syntax but it's not working, possibly due to the ordering of ignoring. I tried it like the following:

# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
**/wwwroot/lib/
!/wwwroot/lib/file-tester
**/wwwroot/_references.js
**/wwwroot/app/**/*.js*
**/wwwroot/css/**/*.min.css
**/wwwroot/js/**/*.min.js
**/wwwroot/bundles/**/*.bundle.min.js

但它不起作用。任何帮助将不胜感激。

But it didn't work. Any help would be greatly appreciated.

预先感谢!

推荐答案

定义如下。

**/wwwroot/lib
**/wwwroot/lib/*.*

这篇关于在已经gitignored的目录中的一个特定目录中排除git ignore的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆