如何递归地.gitignore文件 [英] How to .gitignore files recursively

查看:547
本文介绍了如何递归地.gitignore文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图避免在 .gitignore 文件中出现以下模式。

I'm trying to avoid the following pattern in my .gitignore file.

MyPrject/WebApp/Scripts/special/*.js
MyPrject/WebApp/Scripts/special/*/*.js
MyPrject/WebApp/Scripts/special/*/*/*.js
MyPrject/WebApp/Scripts/special/*/*/*/*.js
MyPrject/WebApp/Scripts/special/*/*/*/*/*.js
MyPrject/WebApp/Scripts/special/*/*/*/*/*/*.js
MyPrject/WebApp/Scripts/special/*/*/*/*/*/*/*.js

我们试过:

We tried:

MyPrject/WebApp/Scripts/special/**.js
MyPrject/WebApp/Scripts/special/**/*.js

然而,这并没有奏效。这是Windows上的git。有没有一个更简洁的方式来做到这一点,而不重复的事情?

This however didn't work. This is git on Windows. Is there a more concise way to do this without repeating things?

推荐答案

从git 1.8.2开始,

As of git 1.8.2, this:

MyPrject/WebApp/Scripts/special/**/*.js

应该按照这个答案。它也适用于Windows 7中使用Sourcetree 1.6.12.0和它安装的git版本(1.8.4-preview20130916)。

Should work according to this answer. It also works for me in Windows 7 using Sourcetree 1.6.12.0 and the version of git that it installs (1.8.4-preview20130916).

为每个文件和文件夹在递归下的目录下:

To gitignore every file and folder under a directory recursively:

MyPrject/WebApp/Scripts/special/**

这篇关于如何递归地.gitignore文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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