I want to whitelist a couple of directories and a file:
/app
/config
/db
Gemfile
A go-to version control, git
, does not allow to track a directory:
# .gitignore:
* # ignore all: suppose I prefer whitelisting
# but not the following things:
!/app/*
!/config/*
!/db/*
!Gemfile
Doesn't work: git only sees Gemfile
.
Do you happen to know if any version control software allows to whitelist dirs and files?
Edit 1
Trying to apply https://stackoverflow.com/a/8025106/788700:
# Ignore everything:
*
# Don't ignore directories, so we can recurse into them:
!*/
# Don't ignore these dirs:
!app/*
!config/*
!db/*
# Don't ignore .gitignore and Gemfile:
!.gitignore
!Gemfile
— doesn't track dirs in app/
, config/
and db/
.
Edit 2: Solved
Using a comment from the above answer:
# Ignore everything:
*
# Don't ignore directories, so we can recurse into them:
!*/
# Don't ignore these dirs:
!app/*
!app/**/*
!config/*
!config/**/*
!db/*
!db/**/*
# Don't ignore .gitignore and Gemfile:
!.gitignore
!Gemfile
Seems to be working.