Example to exclude everything except a specific directory foo/bar
(note the /*
- without the slash, the wildcard would also exclude everything within foo/bar
):
$ cat .gitignore # exclude everything except directory foo/bar /* !/foo /foo/* !/foo/bar
Another example from ansible
# Ignore all folders under roles but the basic folder /roles/* !/roles/basic
Comments