.gitignore ignore all files then recursively allow *.foo

Your problem is that the /* pattern at the beginning is matching all files and directories at the top level – including testdir, so everything inside testdir is ignored.

This is what you want:

# Ignore everything
*
# Don't ignore directories, so we can recurse into them
!*/
# Don't ignore .gitignore and *.foo files
!.gitignore
!*.foo

When you do a git add . with this config, you should find you have only .gitignore and *.foo files listed as changes to be committed.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)