How to use version control on a WordPress project.

Git on a WordPress Project

I’ve spent nine years inheriting digital graveyards—sites so bloated with conflicting plugin decisions and “custom” CSS that you can practically smell the technical debt. Most people will tell you that learning how to use version control on a WordPress project requires a PhD in DevOps or a massive enterprise budget, but that’s just more noise designed to sell you a subscription you don’t need. The truth is, if you aren’t tracking your changes, you aren’t developing; you’re just gambling with your client’s uptime every time you hit save.

I’m not here to give you a theoretical lecture on Git workflows that only works in a vacuum. I’m going to show you the actual, messy way I manage my own builds, from local environments to staging, without losing my mind. I’ll skip the fluff and get straight to the practicalities of how to use version control on a WordPress project so you can stop praying to the server gods every time you deploy a new feature. This is about making sure you can always undo the chaos before it becomes a permanent part of your codebase.

Table of Contents

Mastering the Git Workflow for WordPress Developers

Mastering the Git Workflow for WordPress Developers

Look, you can’t just treat Git like a glorified “save” button and expect your site to survive a deployment. A proper git workflow for WordPress developers requires a level of discipline that most people avoid because it’s “too much work” until their production site goes dark. I don’t care how much you love your local setup; if you aren’t branching for every new feature or bug fix, you’re just asking for a merge conflict that will take three hours to untangle. You need to separate your core logic from the chaos of third-party plugins.

This brings us to the real headache: handling the wp-content folder in git. I’ve inherited enough bloated directories to know that if you commit every single plugin and every single upload, your repository becomes a heavy, unmanageable mess. My rule of thumb? Keep your custom themes and functional plugins under version control, but ignore the rest. You want a lean repo that tracks your actual decisions, not a mirror of every heavy asset someone dragged into the media library. If you aren’t being selective about what you track, you aren’t managing a project—you’re just hoarding files.

Handling the Wp Content Folder in Git Without Chaos

Handling the Wp Content Folder in Git Without Chaos

Here is where most people lose their minds. You open your repository, and suddenly you’re staring at 50,000 files from a bloated plugin or a massive library of unoptimized assets. If you try to track the entire directory, you aren’t using version control; you’re just creating a digital landfill. The secret to handling wp-content folder in git without losing your sanity is discipline. You need to be surgical. I only track my custom themes and my specific plugin overrides. Everything else—the core junk, the massive media uploads, and the third-party plugin bloat—stays out of the repo.

I use a robust `.gitignore` file like it’s a shield. If it’s a plugin you downloaded from the repository, it doesn’t belong in your Git history; it belongs in your deployment script or your composer file. You want your repo to represent your decisions, not every single asset a random developer shoved into a folder. When you focus on tracking only the code you actually wrote, you make staging environments for wordpress sites much easier to manage because you aren’t constantly fighting merge conflicts caused by a stray `.jpg` or a cached CSS file. Keep the repo lean, or it will eventually bury you.

Stop treating your repository like a junk drawer

  • Stop committing your entire database. I don’t care if you think it’s “safe”—pushing a massive SQL dump into Git is a one-way ticket to a bloated repo and a headache you didn’t ask for. Use a migration tool or export specific tables if you must, but keep the heavy lifting out of your version history.
  • Treat your configuration files like they’re radioactive. Your wp-config.php should never, ever hit a public repository. If I see one more developer accidentally leaking database credentials because they forgot a .gitignore rule, I’m going to lose it. Use environment variables or a local config template instead.
  • Stop the “Commit-Everything-At-Once” habit. If you’ve spent four hours tweaking a CSS breakpoint and refactoring a custom plugin, don’t dump it all in one massive commit titled “updates.” Break it down. I want to see the specific decisions you made, not a digital landfill of your afternoon.
  • Use branches for your experiments, not just your fixes. If you’re about to try a new way of structuring a custom post type, do it on a branch. That way, when the theme inevitably breaks because of a conflicting plugin, you can just kill the branch and go back to a version that actually works.
  • Audit your dependencies before you track them. Before you add a new library or a heavy-duty plugin to your workflow, check if it’s actually necessary or if you’re just adding more weight to the ship. If you’re going to version control it, make sure it’s a decision worth documenting.

Stop Guessing and Start Committing

Stop Guessing and Start Committing to Git.

At the end of the day, version control isn’t just some extra chore to add to your sprint; it is your only real defense against the chaos of a live site. We’ve covered how to master the Git workflow, how to keep your `wp-content` folder from turning into a bloated graveyard of media files, and why you need to treat your local environment like a laboratory. If you aren’t committing your changes, you aren’t developing—you’re just hoping for the best. And if there is one thing nine years in this industry has taught me, it’s that hope is not a technical strategy.

Transitioning to a disciplined Git workflow might feel like a massive headache for the first week, especially when you’re fighting against the sheer weight of a legacy theme or a messy plugin stack. But once you start seeing the clear, documented history of every decision made on your project, you’ll wonder how you ever worked any other way. Stop treating your WordPress installation like a fragile glass ornament and start treating it like the engineered system it is. Build with intent, commit with purpose, and for heaven’s sake, never push to production without knowing exactly what you’re changing.

About Rasheeda Volkov

A theme is a set of decisions somebody else made. I read them before installing.

Author photo