I already tried many combinations of the .gitignore but none worked for what I need. I have this tree:
jobs/
jobs/projecta/config.xml
jobs/projecta/garbage
jobs/projecta/more/garbage
jobs/projectb/config.xml
jobs/projectb/garbage
jobs/projectb/more/garbage
Garbage means any other file. I want to commit only the config.xml files, and ignore everything inside jobs/ except them. So I tried:
/jobs/*
!/jobs/*/config.xml
This way, everything inside jobs are ignored, including the config.xml file. With the inverse order, same happens. So, I can force add all config files and changes to them will be tracked, but if I add a new folder inside jobs, it's config.xml won't appear as a untracked file, so this way people can forgot to add them.
I already tried with **, but I got the same.
Any ideas? Thanks!