Version control systems – of which Git is the most commonly used – keep track of changes to the code and other data. When you make changes to a file and then save it to disk, the changes usually overwrite the original content. But if the file is stored in a version control system, the original is not overwritten; the changes are stored in a tree-like data structure and the original can be reconstituted.
WordPress includes a limited version control system in the form of article revisions. Revisions allow users to roll articles back to an earlier point in time. But version control is useful for more than undoing changes to articles. The version control systems used by professional developers allow them to manage changes to the code, to collaborate, and to keep copies of code on remote infrastructure as a backup.
What Is Version Control Good For?
There are many advantages to using version control.
- Turn back time. Because every change made to a piece of data is stored, it can be rolled back or selectively applied.
- Collaboration. Many developers can work on version controlled data at the same time, applying their changes in turn.
- Branching. Branching occurs when different sets of changes are made to the same data. This is useful for creating parallel versions, which may or may not be merged at some point in the future.
- Backup. Version control isn’t a substitute for a comprehensive backup, but a remote version-controlled code repository is a useful safety net.
Let’s say you decided to make some changes to your WordPress theme. Over the course of a few days, you modify the typography, color scheme, and layout. When you’re finished, you decide that some of the changes you have made aren’t working. If you had saved the theme without version control, you would have to manually undo the changes or revert to a backup. With version control, you could undo specific changes while leaving the rest of your work in place.
As I have already mentioned, professional developers often use the Git version control system. It is an extremely powerful piece of software, but – and I may get some flack from developers for this – the user interface is horrible. The command line app is a mess of confusing switches, options, and jargon. There are GUI user interfaces that simplify things, but there is still quite a learning curve for non-technical users. And, WordPress needs a fair bit of tweaking to make it play nicely with Git.
Simple Version Control With VersionPress
There have been several attempts to bring simple version control to WordPress. The Revisr project was once promising, but it hasn’t been updated in more than three years.
VersionPress is the best option today. VersionPress brings version control to both WordPress’ files and the database. It uses Git behind the scenes but hides the complexity behind a user-friendly interface. It automatically tracks changes and provides simple rollbacks and selective undo. Even better, VersionPress includes a useful staging feature which can create staging sites and then merge changes, including database changes, back to a live site.
Because Git is doing all the hard work, VersionPress integrates well with existing tools that offer Git compatibility, including WP-CLI, Git GUI clients, and WordPress hosting providers that offer Git on their hosting accounts.
Version control isn’t for everyone, but if you want more control over changes on your WordPress site, give VersionPress a try.