GIT Tutorial | What is Version Control & Version Control System?

Backend Pro

 What is Version Control? 

          Version Control is a common word that we hear in the software development process. It is also known as Source Code Management. 

Version Control manages changes to a file or sets files over time as versions. 

This is a really long tutorial and I have also made a video to make things much more clear & understandable.  

 

What is Version Control System?     

    Version Control tells how to manage the source code as versions but this process is implemented by Version Control System (VCS). The most well-known VCS is GIT.

To further simplify, just think of a version control system as a file system that stores the files along with versions and many other features not provided by the file system. 

Let's understand this in simple terms with an example and a comparison between File System & Version Control. 

Consider you are developing a Java application and you have written 3 classes i.e A.java, B.java, and C.java. I will compare A set of operations that we usually perform on these files with respect to File System & Source Code Management. 

Day 1: 

You have created files A.java, B.java, C.java

File System: It just saves the 3 files and contains metadata such as Author, file size, file types etc.

Version Control System: It also saves the 3 files along with the metadata same as File System. 

At this point, both File System & Version Control System look alike. From day 2, you will see the differences. 

Day 2: 

You have modified the files A.java, and B.java. In A.java, you added a few more methods & in B.java, you updated a few methods & added new methods. 

File System: It just overwrites the 2 files and updates the metadata update time. 

Version Control System: It also overwrites the 2 files but also maintains the changes that are made on these files. You or your teammate can check the exact changes. This functionality is not offered by the File System. 

Day 3:

A member of your team added a few more changes to A.java, and B.java, and another member made changes to B.java and C.java.

File System: It just saves all changes but when you look at B.java the last change by is Team Member 2. But you couldn't know the same file is also changed by Team Member 1.

Version Control System: It saves all changes made to A.java, and B.java but also maintains the series of changes done by Team Mate 1 & Team Mate 2. You can see the exact changes that are done by Team Mate 1 & Team Mate on B.java. 

Advantages of Version Control System

  • Allows you to compare changes to files over time. 
  • Provides the ability to revert files to a previous state & also the entire project to a previous state. 
  • Allows you to see who, when modified the files that are causing problems in System. 

Types of Version Control Systems

Version Control Systems are broadly divided into 3 categories.
  • Local Version Control Systems
  • Centralized Version Control Systems
  • Distributed Version Control Systems

Local Version Control Systems

Local VCS maintains a simple version database on the local computer that keeps all the changes to files in versions. 
This is not suitable for distributed development process where multiple people work together. 

This is best suitable for IDEs such as IntelliJ, and Eclipse which provide a feature to look at the history of changes made to a file. 

The Local Version Control System looks like below

Centralized Version Control Systems

When people need to collaborate on a project, then the local VCS doesn't help. Hence to deal with this problem Centralized Version Control Systems were developed. 
A Centralized Version Control System contains one central server to maintain the files in different versions. For many years, this has been the standard for Version Control. 
The popular tools in this category are CVS, Apache Subversion, and Perforce. 

The centralized Version Control System looks like below

Advantages:

  • A team can collaborate and work together on the same project. 
  • Everyone can save their changes to the central server and no need to worry if their local computer is corrupted. 
  • An Administrator can have fine-grained control over who can do what & it makes life easier for the admin as he has to take care of only the centralized server as opposed to local databases on each client. 

Disadvantages:

  • Single point of failure that the centralized server represents. 
  • If the server goes down for hours, the team cannot collaborate and cannot save their changes to the server. 
  • Since the entire project is on a single server, you risk losing everything. 

Distributed Version Control Systems

The Distributed version control systems address the problems of centralized VCS. 
In DVCS developer checks out the complete code base, including its full version history i.e fully mirroring the repository. Each checkout effectively works as a remote backup thereby avoiding the centralized server as the single point of failure. 
If the server dies, any of the client repositories can be copied back to the server to restore it. 

DVCS synchronized the repositories by transferring patches (only changes) from peer to peer. 
GIT is the most popular Distributed Version Control System.
DVCS looks like below




Advantages: 

  • Allows users to work offline without connecting to the server. 
  • There is no need to connect to the central server for common operations such as commits, version history & reverting changes. 
  • Allows users to create their own branches locally without publishing until the work is done.
  • Removes a single point of failure as each check out is a mirror of the server & can be used to restore in case of server failures. 

Disadvantages:

  • Lack of locking mechanism. 
  • Initial checkout takes time & takes additional memory as the entire repository is mirrored in the local computer. 

Conclusion:

These are just a glimpse of the advantages that are provided by Version Control & Version Control Systems. The VCS evolved a lot and added many many features to ease the software development. 

In the 20th century, you don't see software product development without VCS. 

#buttons=(Accept !) #days=(20)

Our website uses cookies to enhance your experience. Check Now
Accept !