git - gitignore directory exception not working -
i have following folder structure:
public media catalog product category private tmp var test
i want gitignore in media
directory except catalog/category
, private
my gitignore trying is:
public/media/* !public/media/catalog/category/ !public/media/private
but doesn't work. new files added category
or private
directories not available add.
i git add force done through gitignore if possible
it's simplest put .gitignore
@ level starts matter. (this helps if ever split repository or move directories around.) in case need ignore except catalog
, private
in public/media
folder in public/media/.gitignore
put:
/* !/catalog/ !/private/
and in public/media/catalog/.gitignore
put:
/* !/category/
it's important (and reason rules not working) not ignore public/media/catalog
directory itself, otherwise in ignored, if didn't want ignore specific part of contents.
of course, can combine single ignore @ public/media
level if like:
/* !/catalog/ !/private/ /catalog/* !/catalog/category/
Comments
Post a Comment