I'm trying to ignore everything except docker-compose.yml
files wherever they may be:
- root
- .git/
- .gitignore
- folderA
- docker-compose.yml
- folderB
- .git/
- data/
- docker-compose.yml
In the above directory example, the only things that git should track are both docker-compose.yml
files and the .gitignore
file.
I have tried the following .gitignore:
/*
!.gitignore
!docker-compose.yml
and also
/*
!.gitignore
!**docker-compose.yml
and also
/*
!.gitignore
!**/docker-compose.yml
and also
/*
!.gitignore
!/*/docker-compose.yml
I've also tried the above options with just *
at the top instead of /*
All of which result in only the .gitignore file being tracked.
I'm probably missing something really silly and small but hey ho. Thanks in advance.
UPDATE
I have come closer to a solution with:
*
!/.gitignore
!*/
!*/docker-compose.yml
It is now successfully including all the docker-compose.yml files, however it is now also including sub-repositories and some random files such as root/nextcloud/data/html/core/vendor/zxcvbn/LICENSE.txt