We use cookies to understand how you interact with our site, to personalize and streamline your experience, and to tailor advertising. By continuing to use our site, you accept our use of cookies and accept our Privacy Policy.

Your Digital Commerce Experts
Nexcess Logo

What is Wordpress Version Control? Examining Your Options

July 11, 2022

What do you do when valuable files or your entire site is lost due to a simple mistake or catastrophic disaster? WordPress version control can help identify changes made to files or documents, allowing you to restore what is necessary to keep your business up and running.

Keep reading this blog to learn:

What Is WordPress Version Control?

In the world of software development, mistakes are part of everyday life. To make it easier, developers use version control tools so they can track changes to the files and documents and if needed revert them to a previous version. Version control acts like an “undo” button for your site.

If you dislike the code that one of your technicians wrote or even if the code is broken, you can simply revert your entire site to the previous versions. There are a lot of version control tools available. Today we will be focusing on how you can use WordPress with Git and its tools.

Applied to WordPress, version control allows you to track changes made by you or others on your site. WordPress version control can track actions like:

  • Installing or uninstalling a new plugin.
  • Changing your WordPress theme.
  • Updating your core software or any theme or plugin.
  • Detailed change history.

And much more.

Benefits of Using WordPress Version Control

The most important benefit of WordPress version control is security and confidence with simple execution. With WordPress version control, you can freely change your site. If you don't like it, just undo the process to the last version you liked.

Secondly, if you have a team of developers working on your WordPress site, you´ll be able to work together, as now you can track everything that is happening. The only thing you need is WordPress deployment flow, or Git Repo. Additionally, you can duplicate parts of your site's code and "merge" them back once you are happy with the results.

Finally, the last big benefit of WordPress version control is monitoring. With WordPress version control, you will be able to see if one of your editors updated an already published post. If they did, you can see what changed and roll it back if needed.

There are more benefits for you to explore once you get more experienced with version control. For now, this is all you need to know.

WordPress Version Control Options

There are a lot of options with WordPress Version Control depending on your technical knowledge and how in depth you want your version control to be.

Here are WordPress version control options that you might want to learn in more detail:

  • GIT — There are a bunch of ways you can use Git with WordPress, including hosted repositories like Github. To learn more about Git, make sure to read our guide to GIT and usage workflows.
  • VersionPress plugin — A powerful open source Git plugin for WordPress.
  • WP Rollback — A really simple tool to roll back updates for themes and plugins.
  • Git Hooks — These are commands used to automate your version control.

We’re just getting started — there are more options for you to explore once you get progressively better with Git.

How to Use Git With WordPress

Git is a powerful open source version control system created in 2005, but it’s not the only one. The main WordPress repository is run via SVN, though you can find a Git copy as well. Git offers WordPress users an enhanced backup method and a way to manage changes to a site with a level of granularity that is not possible with most backup tools. Git also has a lot of plugins and hooks to make WordPress version control as easy as possible.

Typically, you’ll want to manage your WordPress site’s code in a hosted repository at something like GitHub, Bitbucket, or GitLab. Then you can deploy your site from that repository to your live server as needed.

Let's get a little technical now. What level should the root of your Git repository be in your folder hierarchy? If you are building a theme, then you can make the theme folder your repository. The same logic applies to building a plugin.

It can happen that you are working on themes and plugins at the same time. If that happens, you can make your wp-content folder as the location for your repository. When you do this, make sure to ignore the uploads folder so that you don’t add all the images and uploaded files to the repository. They can clutter up the repository and slow Git down.

VersionPress Plugin

Let's talk a little about VersionPress. WordPress has a revision tracking system built in. It's great when you want to recover a paragraph you deleted in haste, or check exactly who made an edit to an article. But it's laughable in comparison to VersionPress, which is much more user friendly and gives you a quick undo button for WordPress, easy branching and merging of files, and even a WordPress database.

You also get ridiculously efficient backups — and we mean hundreds of fullsite snapshots in a few megabytes. If that doesn't sound game changing, we don't know what does.

Just a quick note: VersionPress is young. It works fine on simpler sites and you're encouraged to try it in your development workflows, but it is not production-ready yet.

WP Rollback

WP Rollback is yet another plugin you can use to help you out. It's not as comprehensive as the plugins listed above, but it has its purpose. WP Rollback is intended to help WordPress users have a simple way to manage the versions of their plugins and themes.

Although this is not mandatory, life without it may be painful. If you don't have WP Rollback and something breaks, you will need to restore a whole backup of the site. Or, you’ll have to learn how to find the correct previous version on the WordPress repository, download the zip file, and learn how to use FTP to replace the plugin or theme with the older version.

But with the WP Rollback installed, you can simply choose the previous version from a list, hit confirm, and you are back to your old working version. A quick note: please do not use WP Rollback on a live site without testing the rollback locally.

Git Hooks

Git hooks  are scripts and commands to use if you want to automate your version control. To start, you’ll see a bunch of files with .sample file extensions. The files are named to correspond with the hook they run on. So, post-commit.sample runs on the post-commit hook. You can use pretty much any language to write a hook. Git hooks are very versatile but they can be confusing and complicated to work with. Read our blog on Git hooks which covers more.

Git Workflow

We mentioned earlier that with version control you can split the code and merge it back together later once you are happy with it. You can do that with git-flow and Github-flow.

In git-flow, you use two branches with infinite flow. First, the main one which should reflect code that is ready for deployment to your main site or live environment. Second, we have our development branch which is used for our latest changes in the software. When the changes are ready, we can merge them into one again and tag that branch with the corresponding release number.

Try Fully Managed WordPress Hosting From Nexcess

You may find yourself asking, Okay where do I get my own WordPress site to try out all these version control tools I now know how to use?

Well look no further, Nexcess has got you covered with fully managed WordPress hosting.

Get access to an expert support team always ready to help and rest easy knowing that the Nexcess security team will be proactively monitoring your site at all times. With Nexcess, you’ll get automatic 30-day backups, free migrations, and unparalleled performance.

We also offer a 30-Day Money Back Guarantee included in every plan. Check out our WordPress hosting plans to get started today.

Miles Zimmer