git - Subdirectory ignored in .gitignore whitelist -
this question has answer here:
- git won't un-ignore directory 4 answers
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
Post a Comment