Version control is simply keeping record over the changes in particular object. Version control system is a system that records changes to a file or set of files over time so that you can recall specific versions later. In simple words, version control system allows a user to track the changes over a file in the form of versions, so that at any point of time user can traverse back to desired version of file. Version control has reduced lot of pain of developers where they need to keep track of changes in their code. With the help of version control managing central repositories have become easy. Github is a great example of version control system.
Need For Version Control System
Imagine you have written some code and submitted for review. While the review process completes you continue to write the code in the same file. And review process suggests you to change some piece of lines in the code which you submitted earlier. Now the problem is that you continued to write the code and may have made the changes in the code you submitted earlier. How will you identify what piece of information is to be edited? This may go on. Every time you make changes you will have to make different version of the file manually and store them somewhere, so that you can have track of your data. This is really hectic process to follow.
But version control has given us the solution. It keeps track of changes in your file and automatically creates version of the file whenever changes are found. Which helps us to track the changes over time.
How Does Version Control System Work
Suppose you are working on some piece of code. You will have to add the file you are writing into version control system. Version control system will now treat this file as a master copy. While you are alone working on the file you can directly submit your changes to master copy of the file. Now your partner and you want to work on the same file. So, what you will do is create two branches of the file say “a” and “b”. After this you and your partner will start working on “a” and “b” branch respectively. And no one will touch to master copy/branch. Now when you both feel that your part of work is completed you will first merge your branches i.e. “a” and “b” branch, and then you will merge the earlier merged branch into master branch.
In the process of modifications to the file whenever you made changes to the file and submit the changes to your branch, every commit is recorded and you can travel back to the point you want. This helped you to keep record of everything you wrote in your file.
Types Of Version Control Systems
There has to be some system in place when a big team has to use it. The system on local machine won’t help at all. Here are three types of Version Control System :
- Local Version Control System : This is the simplest type of version control system. Here the system has local database which keeps track of changes made to the file on local machine only. This type of system can only be used if only a single person is working.
- Centralized Version Control System : This type of version control system is same as Local VCS. But, here the database or the VCS work on a centralized server. Many clients can connect to the server simultaneously and update the central copy of the file. This type of VCS can be used when a team has to work collaboratively.
- Distributed Version Control System : This is the most popular version control system. It works same as Centralized VCS but in slightly different manner. Suppose in Centralized VCS if the server fails the central copy of the file will be lost forever. Distributed VCS overcomes this problem by storing copy of all data on each client. Here all the files are stored at centralized location as well as on all the client machines so that in case if the server fails the data can be recovered from any client machine. Github is the example of distributed VCS.
Version control system has helped us to manage our repositories very well. VCS is mainly used in IT industries. platforms like Github provide the service free of cost up to certain limits. If you are developer than you should definitely use one of the VCS. This will make your life easy.
If you feel something to add to the above article feel free to comment down below. We are always open for questions.