Reputation: 95
I'm a bit overwhelmed with the amount of gitignore related questions on stackoverflow, but couldn't find one with the same problem I currently have:
This is my file structure:
➜ main git:(master) ✗ tree
.
└── lib
├── folder1
│ ├── sub1
│ │ └── test.txt
│ ├── test.md
│ └── test.txt
└── folder2
├── sub1
│ └── test.txt
├── test.md
└── test.txt
5 directories, 6 files
I would like to exclude the lib folder, but include every file with the extension ".txt".
This is my current .gitignore file:
➜ main git:(master) ✗ cat .gitignore
/lib/
!/lib/**/*.txt
Unfortunately, the whole lib folder is excluded and no textfile is included.
I also have tried countless of other patterns, but I end up either with the lib folder being ignored by git or a lib folder which is being included with all of its files.
It's also important to me that I don't have to specify each subfolder in my .gitignore (like !folder1/
, !folder2/
).
Upvotes: 1
Views: 876