.gitignore exclude files in directory but not certain directories

Git doesn’t track folders, only files, so if you ignore everything in a folder, Git won’t have anything to track. You can add a .gitignore file to each directory (application/cache, application/cache/folder, application/cache/folder/onemorefolder/) with the following contents:

*
!.gitignore

Then, you can add those directories, and only the .gitignore file in each directory will get added — but this means the directories will now be tracked (i.e., created when cloning).

Leave a Comment

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