Ignore whole Directory and allow only some folders
This wiki will help you add specific directories in the parent directory
Lets say you have two directories
- app
- vendor
in "app" directory there are three folders
app/dir1
app/dir2
app/dir3
app/etc
in "vendor" directory there are three folders as well
vendor/dir1
vendor/dir2
vendor/dir3
you would like to add to GIT repository only these directory
app/dir1
app/dir2
vendor/dir3
in this case you need to add this code to your .gitignore file
!/app
/app/*
!/app/code
!/app/design
!/vendor
/vendor/*
!/vendor/lesite
!/vendor/mirasvit
now if you want to allow the directory and ignore one file (EX. env.php) you need to add this
!/app/etc
/app/etc/env.php
the whole file will be
/* !/app /app/* !/app/code !/app/design !/app/etc /app/etc/env.php !/vendor /vendor/* !/vendor/lesite !/vendor/mirasvit