We have till now came across the understandings of Version Control System and its different features. The most popular version control system or VCS is GIT. This is why we are covering the complete series on Git. In this tutorial we will learn
- What is Git?
- Why to use Git?
What is Git?
Git is an Open Source Distributed Version Control System. Now that’s a lot of words to define Git. Let me break it down and explain the wording:
Git is a Control System
This basically means that Git is a content tracker. So Git can be used to store content and it is mostly used to store code. It has many other features, due to which it is quite popular in development community.
Git is a Version Control System
The code which is stored in Git keeps changing as more code is added. Also, many developers can add code in parallel. So Version Control System helps in handling this by maintaining a history of what changes have happened. Also, Git provides features like branches and merges, which I will be covering later.
Note: For more information on VCS, please read What is Version Control System?
Git is a Distributed Version Control System
Git has a remote repository which is stored in a server and a local repository which is stored in the computer of each developer. This means that the code is not just stored in a central server, but the full copy of the code is present in all the developers’ computers. Git is a Distributed Version Control System since the code is present in every developer’s computer. I will explain the concept of remote and local repositories later in this article.
Note: For more information on Distributed VCS and why we need it, please read What is Distributed Version Control System?
Git was developed by Linus Torvalds, the same engineer who developed Linux Operating System. The situation which made him code Git is the actual definition of VCS. Linus Torvalds thought of a version control system for his operating system Linux because there did not match any available system to match his needs. This was much needed since Linux was open source and many developers wanted to contribute to Linux. A VCS would bring about a greater pace in the patch release and the development of this OS. All this made him develop GIT which is a version control system.
Why to use Git?
Since the development and release of Git, it has gained a huge popularity among the developers and being open source have incorporated many features. Today, a staggering number of projects use Git for version control, both commercial and personal. Let’s see why Git has become so popular by discussing its main features
- Performance: Git provides the best performance when it comes to version control systems. Committing, branching, merging all are optimized for a better performance than other systems.
- Security: Git handles your security with cryptographic method SHA-1. This algorithm manages your versions, files and directory securely so that your work remains only yours.
- Branching Model: Git has the most different branching model than the other VCS. Git branching model lets you have multiple local branches which are independent of each other. Having this also enables you to have friction-less context switching (switch back and forth to new commit, code and back), role-based code (a branch that always goes to production, another to testing etc) and disposable experimentation (try something out, if does not work, delete it without any loss of code).
- Staging Area: Git has an intermediate stage called as “index” or “staging area” where commits can be formatted and modified before completing the commit.
- Distributed: Git is distributed in nature. Distributed means that the repository or the complete code base is mirrored onto the developers system so that he can work on it only.
- Open Source: This is a very important feature of any software present today. Being open source invites the developers from all over the world to contribute to the software and make it more and more powerful through features and additional plugins. This has led the Linux kernel be a software of about 15 million lines of code.
As for now we have understood that git is more powerful and leading the race in version control systems. After understanding what and why, it is better to understand how to use git.