git ignore exclusions
git ignore exclusions
If you want to exclude all files matching a general patterns, but explicitly exempt some files from exclusion put a negation rule after the general rule. Later patterns beat earlier patterns.
For example:
# exclude tfvars that may contain sensitive information except known defaults
*.tfvars
!/proj1/proj1.tfvars
!/proj2/proj2.tfvars
To list all files already in git that would be ignored if created now:
git ls-files | git check-ignore --no-index --stdin
Including --verbose will show matches against any rule, which includes exclusion (!...) rules.
git ls-files | git check-ignore --no-index --verbose --stdin