If you are a programmer or developer and working on software applications or any website, you will definitely require some versioning system to track the changes. Version Control System is also referred as SCM (Source Code Management) tools or RCS (Revision Control System).
Version Control is a method or a category of software tools that helps to keep a track of changes in the code so that if something goes wrong, we can make comparisons in different code versions and can easily revert to previous versions. It is very helpful when multiple developers are continuously working or changing the source code.
Advantages of Version Control System
Using VCS, the programmers can review the project history to find out the following details:
- Which changes were made in the code?
- Who made the changes in the code?
- When were the changes made in the code?
- Why were changes needed?
Here is a simple graphical illustration that gives you an idea about how VCS actually works.
In the above figure, first line with the light blue balls are the master branch which is the main branch of the source code. So v0.1 and v0.2 are the multiple versions created to take the kind of snapshot of the whole source code. We have created multiple branches from the master branch like release, develop and hotfix branch according to the requirement. Multiple developers can work on the same project by creating different branches and at the end merge it to the master branch.
Types of VCS
There are two types of VCS, namely:
- Centralized version control system (CVCS),
- Distributed version control system (DVCS).
First, let us see a quick glance about Centralized version control system.
Centralized Version Control System
Centralized Version Control System works on a Client-Server relationship. Server will have all the information which is transferred to the client. You can say that it is a kind of shared repository which provides latest code to the developers. So developers will be working on master copy every time. It is as simple as you have to pull the latest copy of code, work on it (commit changes) and then push the code back to repository.
The main disadvantage of the Centralized VCS is that it is a single point of failure. If central server went down then you cannot used it. If you are doing remote commit then it will take time as well. You will need internet connectivity to commit any changes.
- Open source -> Concurrent Versions System (CVS), Subversion (SVN).
- Proprietary -> TeamCity, Vault, IBM Configuration Management Version Control (CMVC).
Distributed Version Control System
Distributed version control system has a centralized repository as well as all developers have local copy of repository.
Developers can work on their local copy simultaneously. They do not required internet connectivity to work on the code. They can do everything in the code except push and pull. If the central server went down then also there will be no impact because of the local repository.
- Open source - Git, Mercurial, Bazaar.
- Proprietary - Visual Studio Team Services, Plastic SCM.
Difference between SVN (Centralized VCS) and GIT (Distributed VCS) architecture
The following graphic explains the difference between CVCS and DVCS.
From the above figure, we can easily recognized that in SVN (Centralized VCS) we have only central repository but in GIT (Distributed VCS) we have central repository as well as local repository.
Hope you got the basic idea about VCS and its types. We will publish more guides related to VCS in the days to come. Stay tuned!
About the Author:
Dhruv Tiwari is a DevOps Engineer who loves automating things, working with Linux at scale and dream of the day when systems are smart enough to never need to login to a Linux box. Journey Of CI/CD from source code to code deployment to production.