tags:

views:

3166

answers:

4

I'm using msysgit and have a project tree that contains many bin/ folders in the tree. Using the .gitignore file in the root of the project I need to ignore all .dll files that reside within a bin/ folder anywhere in the project tree. I've tried "bin/*.dll" but that doesn't work, I assume it is only working against the bin/ folder in the root of the project.

+3  A: 

Did you try:

**/bin/*.dll

It does work with my msysgit1.6.3 (with a .gitignore file at the root directory of the Git workspace).

Actually the above would only ignore 'x/bin/z.dll', not 'x/y/bin/z.dll'.

Another syntax could be:

**/*/bin/*.dll

But that would only get depth 3, not depth 2!

So if you do not have too many place where *.dll need to be ignored, the simplest solution would still be a local .gitignore file in those 'bin' directories...

Or a collection of directive to cover the main first depths:

bin/*.dll
**/bin/*.dll
**/*/bin/*.dll
**/**/*/bin/*.dll

and so on, all in one .gitignore file.

VonC
I'm using msysgit 1.6.3 also but the pattern **/bin/*.dll didn't work. I added that pattern to my .gitignore in the root and then tried "git add --dry-run *.dll" from the root and it listed my .dll files contained in the bin/ folders of my project tree.
+2  A: 

I just have /bin in my file and it seems to work. It ignore the whole folder (as opposed to specific files in it)

Here are the complete contents as of now (still evolving).

.svn*
obj/
bin/
*.suo
*.user
Log/
log/
*.db
Chetan Sastry
A: 

*/bin worked for me

I'd think that */bin/ would as well.

rball
That only works to depth 1: http://www.kernel.org/pub/software/scm/git/docs/gitignore.html "wildcards in the pattern will not match a / in the pathname"
I82Much
so what would work? \*/bin\*? I think I did that later... for a different directory.
rball
A: 

Just had a similar problem and realized: The files were already added and checked in to git.

How to recognize the difference: Git didn't show the files as "new", but as "modified". This details has cost me quite some time...

If that is the problem, simply "git rm" these files and start over. Suddenly, .gitignore starts to work as expected.

Josef D.