WordPress version control helps you track changes to your WordPress site to monitor what’s happening and roll back those changes if needed. Those changes could be simple tweaks like edits to a post or more technical changes like edits to your site’s codebase.
In this post, we’ll explain more about what version control is and how it applies to WordPress. Then, we’ll dig into some of the tools that you can use to implement version control on your WordPress site.
What is WordPress Version Control?
A version control system tracks changes to a file (or files) over time so that you can see how things have changed and, if needed, revert to a previous version.
Applied to WordPress, version control lets you track changes that you, or others, make to your site.
In a WordPress context, version control can track actions like:
- Updating or publishing a post.
- Installing or uninstalling a new plugin.
- Changing your WordPress theme.
- Updating your core software or any theme or plugin.
Not only you can see these changes, but you can also undo them or roll back to a previous version if needed.
In a development sense, version control can also help developers manage changes to the codebase by letting them clone sections of code to work on before “merging” it back into the main codebase. Depending on the complexity of your WordPress site, you may also find this functionality helpful.
A very limited example of version control in the context of WordPress is WordPress’ built-in Revisions feature, which lets you compare changes to a post or page and restore a previous version if needed:
But you can also implement much more robust systems and, depending on which WordPress version control system you use, you’ll be able to track changes to both your site’s files your site’s database.
What Are the Benefits of WordPress Version Control?
There are a few big benefits to setting up WordPress version control.
First off, version control lets you be more confident in making changes to your site. Made a change that messed something up? No worries, you can just undo it and revert back to a working version of your site.
Second, if you have a team of people helping with your WordPress site, you’ll be able to work more efficiently together because you can track everything that’s happening. Additionally, if you use an approach that supports branching and merging, developers will be able to duplicate part of your site’s code to work on and then “merge” that code back into your live site when it’s ready for primetime.
Finally, version control helps you monitor what’s happening at your site. For example, version control lets you see if one of your editors updated an already-published post. If they did, you can see what they changed and easily roll things back if needed.
So now that you know more about setting up version control on your site, let’s dig into some of the solutions for WordPress version control.
The Best Options for WordPress Version Control
There are several solutions for WordPress control depending on your technical knowledge and how comprehensive you want your version control system to be.
Here are the WordPress version control solutions that we’ll cover in more detail:
- Git – there are several ways that you can use Git with WordPress, including hosted repositories like Github, GitLab, Bitbucket, etc.
- VersionPress plugin – this also implements Git but in a much more natural way, though it’s still in beta.
- WP Rollback – a really simple system to roll back updates for themes and plugins.
- Bedrock – Created by the team over at Roots, Bedrock is set up in such a way that you can easily maintain a repository for version control. Check out our tutorial on how to use Bedrock at Kinsta.
And of course, you can also make use of WordPress’ built-in Revisions system to track and undo changes.
How to Use Git With WordPress
Git is an open source distributed version control system created by Linus Torvalds in 2005. It’s a little more technical, but it’s one of the most popular version control systems and used by all types of developers. That is, it’s not specific to WordPress.
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.
If you want to use Git with WordPress, you have a few different options.
First, if you’re hosting at Kinsta, we have the Git client available, so you can SSH in and pull your Git repository from any service, including GitHub, GitLab, and Bitbucket. You can learn more in this knowledge base article.
Or, there are also other WordPress-specific and general tools to help you deploy from Git.
If you want a WordPress-specific solution, two good options are:
- WP Pusher – lets you deploy themes and plugins from any Git repository. Note that this one focuses specifically on themes and plugins.
- Revisr – offers a much more comprehensive approach to using Git with WordPress. You can track your entire site, including your database, in a Git repository. You can also commit changes from inside your WordPress dashboard, revert files, and push/pull changes to a remote repository (like Bitbucket or GitHub).
How to Use VersionPress for Version Control
VersionPress is an open source project that aims to “bring the full power of Git to WordPress” by version-controlling both your site’s files and database. Though it also relies on Git, VersionPress gets its own section because it does things a little differently than the methods above.
The unique thing about VersionPress is that it tracks every little change and does it in natural human language. For example, instead of just logging a change to your database, VersionPress will tell you that someone “updated the Hello World!” post. Obviously, this makes Git a lot more useful and accessible in the context of a WordPress website.
For example, compare a list of actions in VersionPress to the list of actions in the Revisr screenshot above. See the difference?
While that definitely sounds nice, it’s important to note that VersionPress is still considered a “Developer Preview”. The developer says that you should not use it on a production site.
To install VersionPress, you’ll need to have Git installed on your server and enable proc_open().
Kinsta does not support VersionPress because of this proc_open() requirement, which Kinsta will not enable for security purposes. If you’re hosting your WordPress site at Kinsta, you can still use Git for version control using any of the methods from the previous section.
How to Use WP Rollback to Undo Updates
WP Rollback is not nearly as comprehensive as any of the previous solutions and only works with themes and plugins from WordPress.org. Still, it is a really helpful version control tool on a more limited basis.
Ever updated a WordPress theme or plugin only to have it break something on your site?
Well, first off, you should be using a staging site so that doesn’t happen! But if you’re running updates on a live site and something goes wrong, it’s helpful to be able to roll back to the previous version that worked, at least until you can figure out what’s going wrong.
To help you do that, WP Rollback adds a new Rollback button in your site’s plugins interface that lets you “roll back” any WordPress theme or plugin to the previous version:
You can then choose the exact version you want to revert to:
Version control helps you track changes to your WordPress site so that you can stay on top of what’s happening and roll things back if needed.
If you’re working in a team, version control also helps you employ more efficient workflows with a system of branching and merging. Team members can duplicate a specific portion of your site to work on and then “merge” it back into the main code when it’s ready for primetime.
For WordPress, you have several options for version control, depending on your needs and technical knowledge.
For developers, Git makes a great option for version control. Kinsta supports the Git client and you can also use tools like WP Pusher (for themes and plugins), Revisr, Beanstalk, and DeployBot to deploy from hosted Git repositories like GitHub.
For simpler, less technical implementations, you have options like WordPress’ built-in revisions feature and/or the WP Rollback plugin.
Finally, while it’s not ready for primetime yet, VersionPress offers the most WordPress-specific implementation of Git and is definitely an interesting project to keep an eye on.
Do you have any questions about how you can get started with version control for WordPress? Let us know in the comments.