You write your codes and compile it, it runs without any error. You add more codes or make changes to the existing codes, re-compile it and suddenly you are greeted with errors. Then the developer spends additional time searching for the mistake and correcting it. Every developer must have faced this situation. Things might be simpler if he is working on a smaller project, but such situation would be very challenging on a larger one. A single change or update to the existing code might cause an error and result in hours of hard work to fix it. This is where version control comes in.
What is Version Control?
Version Control is the management of changes designed to keep track of multiple versions of documents, computer programs, large websites, and other collections of information. It is also known as revision control or source control.
Version Control allows developers to save any or all changes that are made to their code. If they ever face the situation as mentioned above, they can simply turn their code back to the state when it was working, instead of be spending additional hours finding the mistake that broke the code. Developing software without using version control is risky because it is like not having backups.
Version Control System also allows multiple developers to work on a single project and save the changes to ensure that everyone can keep track of what they are working on. Version control also allows traceability, i.e. it allows the developers to trace every change made to the software over time.
Types of Version Control
There are three different types of Version Control Systems – Local, Centralized and Distributed.
- Local Version Control Systems
Local version control system is a traditional approach, where you copy individual files from each computer into another directory. You save the changes in the form of patch sets, where the patch sets are dated and time-stamped. So, in case of the code breaks, the patch sets can be used to re-create what the file previously looked like.
- Centralized Version Control Systems
Centralized Version Control approach was created to solve the problem of collaboration. It has a single central copy of the project on a single server or a repository and if you commit any changes, the changes are directly made to that central copy. You take the files from that repository, work on it and put it back. In centralized version control, you never have a full copy of your project locally. Since this works like a central hub, so the major problem is that all the data would be lost in case the server fails.
CVS, Subversion, perforce are some popular centralized version control systems.
- Distributed Version Control Systems
Distributed Version Control Systems was created to solve the problem of centralized version control systems. In distributed version control, you don’t rely on a central server to store all the versions of a project’s file. Instead, you clone a copy of that repository locally so that you are not working on the original file. You work on the cloned copy of the project, and once all the changes are finalized, you can commit and make changes to that original file.
Another benefit of using distributed version control is it allows the developer to work on multiple projects at the same time.
Git is the most popular and widely used distributed version control system today.
1412total visits,2visits today