.gitignore不了解我在Windows上的文件夹通配符 [英] .gitignore does not understand my folder wildcard on windows

查看:165
本文介绍了.gitignore不了解我在Windows上的文件夹通配符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows上遇到一个奇怪的问题, .gitignore



我希望git忽略所有 .exe 文件,除了 Dependencies 文件夹(和所有子文件夹)。



所以我有:
$ b $ p < $ c> .gitignore :

  *。exe 
!/ Dependencies / ** /*.exe

不幸的是,这不起作用。

与此同时,这样做:

  *。exe 
!/ Dependencies / folder / subfolder / *。exe

所以我想知道,我在搞什么有些东西,或者这是一种错误?



我在Windows上运行msysgit(Windows 7 x64)1.6.5.1-preview20091022

提前输入任何内容:)

解决方案

既然 git 1.8.2(2013年3月8日) ** 是现在支持:


.gitignore 和 .gitattributes 文件可以具有 ** / ,作为匹配0级或更多级别的子目录的模式。 p>

例如 foo / ** / bar 匹配 bar in foo 本身或在 foo 的子目录中。

在你的情况下,这意味着现在可以支持这一行:

 !/ Dependencies / ** / *。exe 


I'm encountering a weird issue with .gitignore on Windows.

I want git to ignore all .exe files, except those in the Dependencies folder (and all subfolders).

So I have:

.gitignore:

*.exe
!/Dependencies/**/*.exe

This, unfortunately, does not work.

Meanwhile, this does:

*.exe
!/Dependencies/folder/subfolder/*.exe

So I'm wondering, am I messing something up, or is this some kind of bug?

I'm running msysgit on Windows (Windows 7 x64) version 1.6.5.1-preview20091022

Thanks in advance for any input :)

解决方案

Since git 1.8.2 (March, 8th 2013), the ** is now supported:

The patterns in .gitignore and .gitattributes files can have **/, as a pattern that matches 0 or more levels of subdirectory.

E.g. "foo/**/bar" matches "bar" in "foo" itself or in a subdirectory of "foo".

In your case, that means this line might now be supported:

!/Dependencies/**/*.exe

这篇关于.gitignore不了解我在Windows上的文件夹通配符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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