Reputation: 826
I have a root .gitignore file (Visual Studio) in my project root folder. In some subfolder's I have a folder named 3rdParty which contains folders like lib, debug and release with dll files in it.
I want to commit these to my GIT repo.
In my .gitignore on rootlevel the debug and release are excluded.
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
I have tried putting a .gitignore file in the several 3rdParty folders without the debug and release rule.
#[Dd]ebug/
#[Dd]ebugPublic/
#[Rr]elease/
#[Rr]eleases/
But that didn't work. Is there a way I can set a ! rule in my root .gitignore so that all folders named 3rdParty on all levels are included?
Upvotes: 1
Views: 478
Reputation: 826
The rule !**/3rdParty/** does the trick after all. I had the rule above:
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
When I placed the rule at the bottom of my .gitignore it works. I got the rule from: https://git-scm.com/docs/gitignore
In this section:
Two consecutive asterisks ("
**
") in patterns matched against full pathname may have special meaning:A leading "
**
" followed by a slash means match in all directories. For example, "**/foo
" matches file or directory "foo
" anywhere, the same as pattern "foo
". "**/foo/bar
" matches file or directory "bar
" anywhere that is directly under directory "foo"
.
Upvotes: 1