Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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 :)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.1k views
Welcome To Ask or Share your Answers For Others

1 Answer

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...