If you’re a developer who uses WordPress, chances are that you probably try to implement processes in your development workflow into WordPress. One such process is the use of version control. At the very basic level, version control essentially creates checkpoints in your code, allowing you to go back in time if something goes wrong. Arguably, the most popular version control software today is Git.
Implementing such a system in WordPress is not difficult. You can create a Git repository to manage your WordPress source code (which is possible only on the self hosted version). Additionally, you can create a database dump and add it to the repository. Commits through time would track changes in your files and database.
Although Git repositories can be managed through an array of powerful commands on the terminal or GUI clients which do the heavy lifting, we are going to talk about Revisr in this post. Revisr is a plugin which helps you manage your files and databases within the WordPress admin panel.
Note: I suggest you go through an earlier post on the basics of Git to get familiar with the Git related terms that I am going to use in this article.
Getting Started
After installing and activating Revisr, you need to perform certain steps before the plugin does its work. In the admin panel, go to Revisr → Dashboard to initialize the git repository. Once initialized, it asks you to finalize settings (such as the name and email associated with your Git commits), before you can go back to the Dashboard page to commit.
![Revisr Dashboard](https://uploads.sitepoint.com/wp-content/uploads/2015/03/1425914721revisr-dashboard.png)
Once you have confirmed settings, check the files that you want to stage for commit (Revisr selects all unstaged files by default) and commit them by adding a message.
![New Commit](https://uploads.sitepoint.com/wp-content/uploads/2015/03/1425914715revisr-new-commit-1024x528.png)
Once you have made changes after a commit (like say, installing a new plugin), you can come back to the dashboard and create a commit again.
![Revisr New Git Commit](https://uploads.sitepoint.com/wp-content/uploads/2015/03/1425914708wordpress-git-commit-1024x535.png)
Branching Your Work
One of the most powerful features of Git is the ability to work with branches. The simplest way to understand a branch is to imagine it as a separate workflow. Git also allows you to merge branches.
Go to Revisr → Branches to view a list of branches, create, merge or delete them from within the section.
![Branches in Revisr](https://uploads.sitepoint.com/wp-content/uploads/2015/03/1425914702revisr-branches-1024x311.png)
Managing Remotes
Since Git is a distributed version control software, you may have copies of your repositories on different systems, sometimes on the cloud. In Git, a ‘remote’ is what these copies are called.
If you have a copy of the repository on the cloud (GitHub, BitBucket or GitLab), you can manage the remote using Revisr. Just go to the Remote tab of the Revisr Settings and fill in the details. In this example, I have created a repository on BitBucket (replace [password] with your password).
![Revisr BitBucket Remote Repo](https://uploads.sitepoint.com/wp-content/uploads/2015/03/1425914697revisr-repo-settings.png)
Once you have entered the details of your remote, you can select ‘Push Changes’ under the ‘Quick Actions’ panel on the Revisr Dashboard. In our case, this is how the repository looks once we have pushed the code.
![Revisr BitBucket Changes](https://uploads.sitepoint.com/wp-content/uploads/2015/03/1425914691revisr-logs.png)
Warning
As houghtelin has rightly pointed out in the comments, please take care that your .git directory is not published to production when you are using Revisr. This directory contains some important information and you should definitely make sure it’s inaccessible to the public. There are a few different ways to do this, an easy way is to create an .htaccess file and instruct Apache to deny all requests to that URL.Backup and Restoring the Database
In the introduction, I mentioned taking dumps of the database and attaching them to your regular commits. This is exactly what Revisr does. Before we proceed, you might want to have a look at the database structure of WordPress.
On the ‘Quick Actions’ panel on the Revisr Dashboard, you will find a ‘Backup Database’ button, which instantly backs up your database by creating dump files and committing it, according to the options set in the ‘Database’ tab of your Revisr Settings. Alternately, you have an option to back your database when you are creating a commit.
An error may occur if the correct path to MySQL is not set in the Revisr Settings. For instance, in MAMP, the path to MySQL is /Applications/MAMP/Library/bin/
.
![Revisr Error](https://uploads.sitepoint.com/wp-content/uploads/2015/03/1425914685revisr-error-1024x276.png)
Revisr creates a file for each table that is backed up from the database. Let us push and view the changes on BitBucket.
![Revisr Database Changes](https://uploads.sitepoint.com/wp-content/uploads/2015/03/1425914677revisr-tables-1024x472.png)
Troubleshooting
As you might have observed from the dashboard screenshot above, I was having trouble taking a backup of the database. I debugged the error by finding out that the MySQL path was empty. This was visible in the Help tab of the Revisr Settings page.
![Revisr Troubleshooting](https://uploads.sitepoint.com/wp-content/uploads/2015/03/1425914670revisr-troubleshooting.png)
The help tab contains certain other information that might help you debugging your problems. You may also check the activity log in your Dashboard to find out what might be causing trouble.
![Revisr Changes](https://uploads.sitepoint.com/wp-content/uploads/2015/03/1425914666revisr-changes.png)
Final Thoughts
There are many Git plugins for WordPress, and another popular option is VersionPress. While VersionPress focuses on changes on the site, Revisr gives more weightage to the development cycle (which should excite the developers). VersionPress came up with a detailed post on how the two are different.
Yet another version control management system for WordPress is Gitium.
What I mean to say is that whether you are a developer or just another blogger, managing your WordPress site through version control is never a bad idea. Although it might be a bit difficult to get used to, I assure you the benefits in the long run are going to be immense. At least, you wouldn’t be Googling frantically if you drop your database by accident!
Frequently Asked Questions (FAQs) about Revisr: Git for WordPress
What is the primary function of Revisr in WordPress management?
Revisr is a WordPress plugin that integrates Git into your WordPress dashboard. It allows you to manage and track changes to your WordPress files and database directly from your WordPress admin area. This means you can easily revert to previous versions of your site if something goes wrong, or if you simply want to go back to an earlier version. It’s a powerful tool for developers and site administrators, providing a safety net for changes and updates.
How does Revisr differ from other WordPress management tools?
Unlike other WordPress management tools, Revisr uses Git, a widely-used version control system. This means it can track changes to both your files and your database, giving you a complete picture of your site’s history. It also allows you to easily revert changes, create branches for testing new features, and even push and pull changes to remote repositories.
Is it necessary to have Git knowledge to use Revisr?
While having a basic understanding of Git can be beneficial, it’s not strictly necessary to use Revisr. The plugin is designed to be user-friendly and accessible, even for those who aren’t familiar with Git. It provides a simple, intuitive interface for managing your site’s files and database, and it includes helpful features like automatic backups and email notifications.
Can Revisr be used for team collaboration?
Yes, Revisr is an excellent tool for team collaboration. It allows multiple users to work on a site simultaneously, with each user’s changes tracked separately. This makes it easy to see who made what changes, and when. Plus, with the ability to create separate branches, team members can test new features or changes without affecting the live site.
How does Revisr handle database changes?
Revisr has a unique feature that allows it to track changes to your WordPress database. When you make a change to your database, Revisr creates a backup and stores it in a Git repository. This means you can easily revert to a previous version of your database if needed. It’s a powerful feature that sets Revisr apart from other WordPress management tools.
Is Revisr compatible with all WordPress themes and plugins?
Revisr is designed to work with all WordPress themes and plugins. However, like any plugin, there may be specific cases where it conflicts with other plugins or themes. If you encounter any issues, it’s recommended to reach out to the Revisr support team for assistance.
How secure is Revisr?
Revisr is designed with security in mind. All changes are tracked in a Git repository, which provides a secure, reliable record of your site’s history. Additionally, Revisr includes features like automatic backups and email notifications to help keep your site safe.
Can I use Revisr on multiple sites?
Yes, you can use Revisr on as many WordPress sites as you like. It’s a powerful tool for managing multiple sites, allowing you to track changes, create backups, and manage your files and database from a single dashboard.
Does Revisr support remote repositories?
Yes, Revisr supports remote repositories. This means you can push and pull changes to and from remote repositories, making it easy to collaborate with others or keep a backup of your site in a separate location.
How do I get started with Revisr?
Getting started with Revisr is easy. Simply install the plugin from the WordPress plugin directory, and then follow the on-screen instructions to set up your Git repository. Once that’s done, you can start tracking changes, creating backups, and managing your site with Revisr.
![Shaumik Daityari](https://uploads.sitepoint.com/wp-content/uploads/2014/01/feb5b18a7ac559ec6c8e8afcf96418ac-96x96.jpeg)
Shaumik is a data analyst by day, and a comic book enthusiast by night (or maybe, he's Batman?) Shaumik has been writing tutorials and creating screencasts for over five years. When not working, he's busy automating mundane daily tasks through meticulously written scripts!