Day 2: Version Control System and Git

·

5 min read

Day 2: Version Control System and Git

Table of contents

  • What is a Version Control System?

  • Types of VCS

  • List of VCS tools?

  • What is Git?

  • Git features

  • Git workflow - 3-Tier Architecture

What is Version Control System?

A Version control system (VCS) is a Repository of files, every change made to the files is tracked with revisions, along with Who made the change, Why they made it, and references to problems fixed or enhancements introduced by the change.

It is also known as Revisions control system (RCS) or source code management(SCM)

It helps the team to ship the products faster, Improves visibility and Traceability for every change ever made, and helps teams collaborate around the world.

Types of VCS

List of VCS tools There are several types of version control systems the teams use today. Some are centralized some are distributed.

  1. Local version control systems

  2. Centralized version control systems

  3. Distributed version control systems

Local Version Control System(LVCS):

A LVCS is a local database located on your local computer, in which every file change is stored as a patch. Every patch set contains only the changes made to the file since its last version. To see what the file looked like at any given moment, it is necessary to add all the relevant patches to the file in order until that given moment.

The main problem with this is that everything is stored locally. If anything were to happen to the local database, all the patches would be lost. If anything were to happen to a single version, all the changes made after that version would be lost.

Also, collaborating with other developers or a team is very hard or nearly impossible.

Centralized Version Control System(CVCS):

A CVCS has a single server that contains all the file versions. This enables multiple clients to simultaneously access files on the server, pull them to their local computer, or push them onto the server from their local computer. This way, everyone usually knows what everyone else on the project is doing. Administrators have control over who can do what.

This allows for easy collaboration with other developers or a team.

The biggest issue with this structure is that everything is stored on the centralized server. If something were to happen to that server, nobody could save their versioned changes, pull files, or collaborate at all. Similar to Local Version Control, if the central database becomes corrupted, and backups haven't been kept, you lose the entire history of the project except whatever single snapshots people happen to have on their local machines.

The most well-known examples of centralized version control systems are ClearCase and SVN.

Distributed Version Control System(DVCS):

With DVCS, clients don’t just check out the latest snapshot of the files from the server, they fully mirror the repository, including its full history.
Thus, everyone collaborating on a project owns a local copy of the whole project, i.e. owns their local database with their complete history. With this model, if the server becomes unavailable or dies, any of the client repositories can send a copy of the project's version to any other client or back onto the server when it becomes available. It is enough that one client contains a correct copy which can then easily be further distributed.

List of VCS tools?

  1. GIT

  2. SVN

  3. ClearCase

  4. Mercurial

  5. TFS

  6. Helix core (perforce)

What is git

Git is an opensource tool and distributed version control system git version control is one of the most popular version control system

It is the most widely used modern version control system in the world today.

It was originally developed in 2005 by Linux Torvalds, the famous creator of the Linux operating system kernel

Git, which stands for Global Information Tracker is an open-source version control system used for source code management. It is used to track changes in our source code and maintains a version history.

It also allows us to collaborate, which means multiple developers work together on a project, bringing diverse perspectives and expertise.

Hence, all the changes can be tracked and can be reverted to the previous one if required.

Git Features

  1. Works on a distributed system

  2. Compatible with all operating systems

  3. Allows for non-linear development

  4. Branching

  5. Fast as a flash

  6. Reliable

Git workflow - 3-Tier Architecture

Git is a distributed version control system that is used to track changes in files and collaborate on projects. It has a three-tier architecture that consists of the working directory, the staging area, and the Git repository.

  • The working directory: is where you make changes to your files.

  • The staging area: is where you temporarily store the changes that you want to commit.

  • The Git repository: is where the permanent history of your project is stored.

When you make a change to a file in the working directory, Git does not track the change until you add it to the staging area. You can add individual files or entire directories to the staging area. Once you have added the changes to the staging area, you can commit them to the Git repository.

Committing a change to the Git repository creates a snapshot of the project. This snapshot is stored in the Git repository and can be retrieved at any time. You can also use Git to revert to previous snapshots of the project, which can be useful if you make a mistake or if you want to experiment with different changes.

The three-tier architecture of Git makes it easy to track changes to your files and collaborate on projects with others. The working directory allows you to make changes to your files, the staging area allows you to temporarily store the changes that you want to commit, and the Git repository stores the permanent history of your project.

Conclusion

Version Control Systems (VCS) are essential tools in software development that enable collaborative work, track changes, and manage different versions of a project.

Git, one of the most widely used distributed VCS, stands out for its efficiency, flexibility, and speed. It allows developers to work seamlessly in parallel, branching and merging with ease, while providing a robust and decentralized structure for code repositories.

Happy learning !!! :)