How to .gitignore Everything in Folder Recursively Except for Specific File Types * !*/ !.gitignore !**/**/*.md !**/**/*.htm* The above .gitignore content ignore everything in the folder and subfolder execpt for the markdown .md htm or html files .htm*.