git - Subdirectory ignored in .gitignore whitelist -


this question has answer here:

i creating git repository linux home directory. want ignore things except files/directories whitelist. have this:

# ignore * # not these files... !.gitignore !*/scripts/* # above line doesn't work, test: !./scripts/* 

but it's ignoring files add scripts/ subdirectory. i've been adding things -f, sub-optimal.

the answer question, git won't un-ignore directory , doesn't work me.

git version 2.1.4.

from the docs:

it not possible re-include file if parent directory of file excluded

you need explicitly unignore both directory and contents, or else ignore rule negating contents cannot match anything. first, unignore scripts, , then can unignore scripts/*.

here working .gitignore:

* !.gitignore !scripts !scripts/* 

that said, because you're unignore *, can away 1 rule, unignores path scripts. second scripts/* redundant.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -