Local Community

Recommended gitignore for "wp-content" Directory


I finally pulled down a WP Engine website with local, yet I’d like to track files in my “wp-content” directory only with git. Then, I’ll push up those files to a private GitHub repo.

What’s recommended .gitignore file text that will live in my “wp-content” directory? I’d also like to ignore all “node_modules” directories recursively as well.

Hey @risingPhoenix1979

In general, there isn’t a “one right” way of using Git and Local (and WPE).

This WPE help doc does have some things to think about:

Can you describe in a little more detail what kinds of things you are wanting to track within the wp-content folder?

My personal preference is to keep the Git repos as small as makes sense. For WordPress sites, that usually means one repo for the theme and one or more repos for any custom plugins. That does make for a little more Git wrangling, but I like the ability to completely archive a theme during a redesign without a bunch or cruft left within a site-level Git repo.