codeigniter - How to ignore all but certain files/directories with Git..? -


i see similar questions, i'm not finding i'm trying reason.

i have codeigniter php library maintain, project full ci install includes library. i'm trying ignore except files make library.

i feel i've read syntax this, i'm getting unexpected results directories.

first, start this:

* !.gitignore !readme.rst !instructions.html 

you can see here grayed out (ignored) except 3 files under site root, means files no longer ignored...exactly want far.

enter image description here

when move on try , un-ignore rest of library files, though, live in directories, doesn't work. example, if add...

!application/controllers/paypal 

you can see directory , files in still grayed out (ignored), , of course when run git commands indeed ignored.

enter image description here

any information on need working appreciated.

simply white-list folders first.

then can start white-listing files

* !**/ !.gitignore !readme.rst !instructions.html !application/controllers/paypal/** 

as usual (i mentioned in "how add files without dots in them (all extension-less files) gitignore file?", there 1 rule remember .gitignore:

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

that means, when exclude ('*'), have white-list folders, before being able white-list files.

check if working git check-ignore -v -- afile see if ignored (and rule) or not.


Comments