Gitignore exclude certain files in all subdirectories
问题 I have a directory called /static. There is a lot of subdirectories in it. I need to ignore all files in all subdirectories of the /static/ directory except of .htaccess, null.jpg and index.php files. Tell me please what is the right syntax for this operation? /static/** !/static/**/.htaccess and /static/* !/static/*/.htaccess don't work. 回答1: As I mentioned in "Including specific file extension in gitignore", the main rule to remember is: It is not possible to re-include a file if a parent