Version Control System

Version Control System

Version control systems are a category of software tools that helps record changes to files by keeping a track of modifications done to the code. It has been divided into three parts.

1. Local Version Control Systems

In this section there are only two things to know

  • a lot of people store their files into a separate folder with a different name. And each time they create a new version of their file or project, they put it into a separate folder to keep a track to go back into previous version if something wrong happens with the current version of the project. But the problem was, you can change your files by mistake or delete them by mistake because all of them are into your local computer.
  • To deal with this issue, programmers long ago developed local Version Control System that had a simple database that kept all the changes to files under revision control. One of the most popular Local Version Control System was RCS(Revision Control System). RCS works by keeping patch sets (that is, the differences between files) in a special format on disk. it can then re-create what any file looked like at any point in time by adding up all the patches. Through RCS you can only work upon a single file not upon a project.

2. Centralized Version Control Systems

The next major issue that people encounter is that they need to collaborate with developers on other systems. To deal with this problem, Centralized Version Control Systems (CVCSs) were developed. Centralized version control systems contain just one server that contains all the versiones of the file and each user gets their own working copy. Here you directly commit your changes to the server and others can see those changes by updating. Two things are required to make your changes visible to others which are:

  • You commit
  • They update

  • But the down side of it is that if the database gets corrupted of the server for some reason and you do not have back up, you will loose all of your data history and versions but the file that is on your local computer

3. Distributed Version Control Systems

This is where Distributed Version Control Systems (DVCSs) step in. In a DVCS (such as Git), you don’t just copy the latest version of the file or project rather, they fully mirror the repository, including its full history means all the versions of the file. Thus, if any server dies, you have all the history or whole repository or backup on your computer which you can again put into the server. In Distributed Version Control System you can create branches where you work separately from you teammates So Just committing your changes will not give others access to your changes. This is because commit will reflect those changes in your local repository(A repository can be thought as a database of changes. It contains all the edits and historical versions (snapshots) of the project.) or in your branch that you created and you need to push them in order to make them visible on the central repository which is the master branch. Similarly, When you update, you do not get other’s changes unless you have first pulled those changes into your repository.

To make your changes visible to others, 4 things are required:

  • You commit
  • You push
  • They pull
  • They update

The most popular distributed version control systems are Git, Mercurial.

Purpose of Version Control

  • Multiple people can work simultaneously on a single project. Everyone works on and edits their own copy of the files and it is up to them when they wish to share the changes made by them with the rest of the team.
  • Version control provides access to the historical versions of a project. This is insurance against computer crashes or data loss. If any mistake is made, you can easily roll back to a previous version. It is also possible to undo specific edits that too without losing the work done in the meanwhile. It can be easily known when, why, and by whom any part of a file was edited.