Before Version Control
When people start their career with the development of WordPress, their workflow starts with downloading files for themes or even plugins via FTP like uploading, editing or even refreshing the page via FTP. You can make mistakes during downloading or even managing files! If you fail to figure out what’s wrong, you have to redo the whole process again. This is not only inefficient, but also very dangerous!
If a person works together with the WordPress developers on the implementation of WordPress websites, the connection between templates of frontend as well as the functionality of the backend can be nothing but a scary black hole. You may face different issues like lost files, overwrites, working off an older version of the project, and being unable to revert to a previous version. Once the functionality has been put into the templates, a designer becomes terrified to touch the files. They are afraid of breaking the code.
Enters Version Control
So if you are a WordPress developer, then it is a must for you to code responsibly. You also have to know the uses of Version Control.
Are You Overdue for Version Control?
Are you overdue when it comes to version control? Well, there are five signs that will give you an idea about whether you are overdue for version control, or not.
- Sign 1: You have no idea about Version Control. You do not know what it is, why you should use it or even what the advantages of Version control are.
- Sign 2: You have no idea what a back up system is. You code only locally without a sharing or deployment strategy.
- Sign 3: You use to backup up the WordPress projects simply by duplicating the common root directory.
- Sign 4: You don’t know what to do if you delete a file accidentally. The only way you know to recover a file is to recode it from scratch!
- Sign 5: After editing the files a few times, part of your application gets broken. You don’t know how many times you have to undo your changes and you are not sure what the main problem is.
Almost every developer out there has faced these issues at last once in their lifetime. Code management problems are very common, especially when you work in a team with several people working on the same code base. The first step to solve these issues is to understand that you are really in trouble.
A Quick Explanation of Version Control
Version Control System (VCS) is also known as Source Control Management (SCM) or Revision Control (RM). Version control solves the problems in the casual project development and team work process. The basic concept of version control is very simple. There is one main repository for all the WordPress project files shared across all development and management systems, and all files are synced with the main repository. You can also compare Version Control System with WordPress Project Management Plugins.
Team members can easily check the files out, they can make changes, and after that they check them back in. Some VCS have an intermediate commit step to a local version of the repository, often different with the main repository state or the current version of the files. VCS will keep the track of all changes. It also notes who changed the development files, when the developers changed them, and what were the changes.
Version control system also allows the users to write small notes about the changes. This note will help the other developers to keep track of the changes and refer back to them later on. Other developers will also be able to know why the changes were made and who changed the files. For each file you will also get a revision history. You can go back to the previous versions easily if you want to change or even edit anything.
An ideal Version Control System allows the users to merge the changes made by two developers at the same file. Multiple users can work together. For example, if you and any of your team members locally work on the same file, then when you push the file back to repository the Version control system will merge the sets of changes and it will create a new file adding both of your changes. If there are any conflicts during the merge, then this system will highlight the conflicts for you.
Immediate Benefits to Use Version Control System
The main benefit of a Version Control System is that it allows multiple developers to work together on a single project. Each change can easily be attributed to a developer.
Local and remote, both types of version control systems has some advantages. However, the negative fact is that if you use remote version control, then everything will be stored on the remote database. If the server goes down, you will not be able to make any changes that are synced back to the team. You can easily use a local VC system to avoid this kind of issues. Following is a list of some benefits of Version Control Systems:
- If you delete some files accidentally, you will be able to revert them. You just have to run a simple command in the terminal.
- It is not possible to overwrite the files by mistake if you use VCS since you could keep track of the revisions log.
- The main repository holds all the latest updated files.
- If you use GitHub, you need not to locally store your files on your computer. GitHub works as a backup during emergency!
- It is possible to work on same file simultaneously.
Bottom Line: If you are planning to use a version control system, then it will be best for you to use Git or alternatively Mercurial. You can try both of them or even other version control system to decide which one is best for you. The WordPress Core is currently stored on a SVN server for historical reasons, but the progress of Git over the last few years has made it the leading system used by professional developers hosting their WordPress projects on version control networks such as GitHub or Bitbucket.