KatPadi's Point

.gitignore All The Files!

This is an example of a .gitignore file that will ignore all files except the ones you specify. This is what I’ve been using for my WordPress development.

Note: This is a product of constant research (aka Google-ing) and failed development practices.


The first line says that it will ignore ALL the files in the root directory. The second line negates it by saying NOT to ignore the .gitignore file itself.

!themes basically says “ignore this whole directory“. Then it gets countered by the next line saying DO NOT IGNORE the directory katpadi-theme.



I had a hard time at first because I was doing a somewhat wrong “shortcut” for this:


Apparently, it can’t be that straightforward. You have to tell the file to unignore the parent AGAIN first and then ignore  its child.

Tip From A Noob Like Me: Write them in pairs so you (and I) won’t get confused. Something like, UN-IGNORE THIS, IGNORE THIS.

Here’s a template I uploaded in Gist for your convenience.

Leave a Reply

Your email address will not be published. Required fields are marked *