Noupe Editorial Team February 14th, 2018

WordPress: Version Control Made Easy With Git

Noupe Editorial Team

The jungle is alive: Be it a collaboration between two or more...

 Sponsors love


Connecting WordPress and Git is not a bad idea per se. But, how can you do that without having to become a Git expert first? I’ll show you in the following article.

The Default: WordPress Unsecured

The most popular CMS amongst our readers is easy to install and to operate. Updates to the functional core are generally automatic unless you don’t want that to be the case. Only major changes require your manual authorization. Themes and plugins are updated automatically, or at least semi-automatically as well.

The catch is that all of this happens live during operation. During updates and installations, WordPress switches to maintenance mode automatically. Thus, the visitor does not have access during the update process. If something goes wrong, the worst case would be that your website is not accessible. If the website is how you make your money, this can be very expensive.

In Git and on the high sea one is in God’s hands. (Photo: Pixabay)

It would be better to be able to test updates and installations in advance, allowing you to roll them back if there are problems. In software development, this job is done by so-called version control systems. These systems note down any changes to the existing code as a new version and save it separately. This way, it is possible to return to any stage of development at any point. The easiest way to imagine this is as a simple backup and restore, although version control systems do a lot more in comparison to this simple process.

WordPress has had a version control system for years as well. However, their’s is restricted to your posts and pages only. Here, while you write a post, WordPress creates backup copies, so-called revisions, in definable intervals. If a problem occurs, you get to access and recover an older version of the post. It is also possible to compare two versions, in order to decide which should be the publicly visible representation. In all other parts of WordPress, this system is missing.

Lone wolves have used local test environments to help with that for a long time already. The live installation, identical to the WordPress site, is stored locally, for editing purposes. This is where you get to tweak your theme and see if it works, and what it looks like. It’s also where you install a new plugin, and check if it is compatible with the other used plugins. Only once everything looks and works fine, upload the changes to the live website.

This is no version control system either, though. All changes that you made locally where done on the open heart. You have changed an existing installation, but it was not online and available to guest, but offline, and only visible to you.

WordPress and Git: a Sensible Combination

Version control systems are the only way to get close to eliminating the risks of working on software projects. If you worked using one, the changes made to your WordPress installation would be tracked and saved in detail.

At any point, you’d have the option to restore an older version, even selectively, regarding a single aspect. This means that not the entire version X is activated, but only the aspects that affect a certain work step. Just look at the revision history of your posts. That’s how things would work for all aspects of your WordPress installation.

Now, it should be clear what this is good for. For the first time ever, you have full control over the CMS and don’t need to fear to break something by configuration or coding. Every change can be removed whenever you want to. Now, if you imagine there were other people working on your website, like a whole design team, you’ll realize that this wouldn’t work without version control. Here at Noupe, Git is our bodyguard.

In fact, version control systems like Git are most effective where multiple people work on the same project at the same time. The control system takes care of all aspects of the collaboration. It even unites changes made at the same time without any conflicts, or at least notifies the users when there are conflicts, and tells them how to solve them.

The most popular version control system is called Git, and is on everyone’s lips, mainly due to the platform GitHub, which is just one of the many ways of Git hosting. I don’t know many open source projects that are not hosted on Github.

Via Github, software teams work together locally and internationally. (Illustration: Stockvault)

The catch is a pretty big one. You’ll quickly realize that Git is not an intuitive solution. In the beginning, the learning curve is rather flat. In other words: you have to work to get going.

WordPress and Git Can Work Together Easier, Though

Git is a command line tool, and, like all of these tools, it is not easy to learn. If you only want to make use of Git’s advantages in conjunction with WordPress, there are a few solutions you may want to take a look at before taking part in a 2-day Git course.

You can get a high-speed overview with Try Git. This short course only takes 15 minutes of your time. If you want very detailed information, you can read the e-book Pro Git with about 500 pages for free here. Yes, it’s tough. And yes, it takes time. And it is not enjoyable.

Thus, in the following, I’ll show you a few plugins that simplify the cooperation of both systems so much, that you can learn what you’re interested in while working, with full functionality being provided regardless of your skills:

VersionPress: the Most Extensive Git Solution for WordPress

VersionPress is a free open source plugin which integrates the Git-based version control into your WordPress installation. The solution is very extensive and even allows real Git experts to use the command line, while Git newbies are able to use the graphic user interface.

Aside from the version control of folders and files, VersionPress also takes care of the versioning of the WordPress database. I don’t know any other system capable of that.

VersionPress: The list of changes. (Screenshot: Version Press)

On top of that, VersionPress also offers the so-called staging, which is the cloning of entire installation. Those only looking for the latter functionality should read this article by my colleague Andreas Hecht. Here, he gives a detailed introduction to the plugin WP-Staging.

VersionPress tracks all changes made to your WordPress website and provides you with access to them from a clean list. Each tracked change is equipped with an undo button. So, click undo, and your change is reverted. Other changes made in the meantime, like new articles or pages, are unaffected by the process, so they are not reverted.

As VersionPress is fully based on Git, you can also manage the according repository using an external Git client, without losing out on the advantages of the solution. In different places, you’ll find the information that VersionPress is a developer preview in a phase of early availability. Don’t be fazed by that. During my tests, I didn’t encounter any problems. Everything works smoothly. Nonetheless, you should still be careful, as the plugin’s way of working is rather complex, always posing the risk of undesired function conflicts and conflicts with other plugins.

Generally, you always need a sustainable backup strategy. In these cases, I go for VaultPress. The solution was developed by Automattic and has a price barely worth thinking about, making it a true no-brainer.

Remember: You need Git. You can’t just install VersionPress and expect everything to just work. However, it doesn’t have to be your own Git server by any means. VersionPress supports all common workflows, like Github, Bitbucket, and others.

VersionPress is free and is supposed to stay free. However, the developers offer a SaaS solution on VersionPress.com, where your entire WordPress can be hosted on. The platform is still under construction. As a developer with 10 sites in the portfolio, you could already book it for 49 USD a month; there are no smaller or bigger offers yet.

WP Pusher: Git for Themes and Plugins

If you only want to manage themes and plugins, a smaller solution does the trick. WP Pusher is a good choice here. WP Pusher works together with GitHub and Bitbucket. The plugin is able to bring changes from these platforms onto your web server and apply them. This can even be done automatically. You don’t need an own Git server aside from GitHub or Bitbucket. Thus, you’re able to use WP Pusher on any web space.

WP Pusher: Install plugins and themes straight from Github and others. (Screenshot: WP Pusher)

WP Pusher is not free, though. While there is a free version, the only thing you get to do on there is connecting public repositories. I doubt that’s what you want to do.

Working with private repositories will cost you. For 99 USD a year, you get to connect five websites, 199 USD gets you 20, and 499 USD a year even 100 sites. Depending on the tariff, a website will cost you between five and 20 USD a year. This should not be a hindrance.

Gitium: Alternative for the Deployment of Plugins and Themes

Gitium by Presslabs takes care of the same problem as WP Pusher. Gitium comes with both an advantage and disadvantage. The advantage over WP Pusher is that Gitium is free under the GPL license, while WP Pusher provides a charged solution.

Gitium’s controls are less intuitive. Precognition is helpful. (Screenshot: Gitium)

The disadvantage is that Gitium requires an own Git server, while WP Pusher only needs Github or Bitbucket.

Revisr.io: Complete Version Management

Revisr walks on the paths of VersionPress, and, just like that one, it is free to use. It is not restricted to just plugins and themes but also edits the database. This gives you very dedicated option to make precise settings whether Revisr should track the entire database or only individual tables. Of course, you could also leave the database untouched.

Revisr: Clear dashboard in the WP-Admin (Screenshot: Revisr)

Revisr cooperates with Github and Bitbucket. Due to the plugin’s extensive interference options, I strongly recommend using a stable backup solution and manually starting it before major changes.

Downer: Revisr hasn’t been updated in two years, but it has rather consistent review grades. I chose VersionPress. In this sensitive area, two years without an update seems too long to me.

Noupe Editorial Team

The jungle is alive: Be it a collaboration between two or more authors or an article by an author not contributing regularly. In these cases you find the Noupe Editorial Team as the ones who made it. Guest authors get their own little bio boxes below the article, so watch out for these.

4 comments

  1. I’ve been using the GitHub Updater plugin for quite some time across many sites. It’s not currently in the WP plugin repo – you have to download and install it manually, but it’s been a perfectly adequate and supports both GitHub and Bitbucket. It’s not perfect, and has a couple things that could stand to be improved, but it’s done a good job at basically bridging that gap for me with regard to git usage in theme/plugin development.

Leave a Reply

Your email address will not be published. Required fields are marked *