I'm using the following code to ignore all files except for certain filenames and extension
*
!.gitattributes
!.gitignore
!readme.md
!.gitkeep
!*.php
For some reason, its only allowing me to commit the .gitignore and readme.md, even though I have php files in subfolders etc. Is there anything wrong with it? Just fyi, I'm using "git add -A" to pick up the files to commit.
The solution is to tell Git not to ignore sub directories:
*
!.gitattributes
!.gitignore
!readme.md
!.gitkeep
!*.php
!*/
Otherwise, only the *.php
files in the first directory level will be accepted and all sub directories will be ignored.