IT is in no way different from any other sector when it comes to naming. You would see some systems being named based on their origin while others are named keeping in mind their features or functionality. Then there are some whose names have nothing in common with their origin, features, or anything else related to them.
It is these inconsistencies in naming conventions that make people confused about what a system is all about, what it does, and what benefits it offers. For instance, there are a lot of people out there who still get puzzled when asked about Git and GitHub and whether or not there is a difference between the two.
The similarity in their names has nothing to do with what they really are. They are two altogether different things. But at the same time, you can say that they still have a thing or two in common. Before we talk about Git and GitHub, let us first shed some light on version control systems (VCSs) and why are they so important.
Table of Contents
What is version control?
In simple terms, version control is nothing but a system that keeps track of the changes made to source code or files. With a version control system, you can look back at the changes made to a particular file, either by you or another person, by accessing the version control database. This system gives you the ability to compare different versions of a file, thus allowing you to stay informed about the changes that have happened over a period of time.
The version control system can be referred to as a database that stores snapshots of different files in a project. These snapshots are taken every time a file is modified. It maintains all the records of the different versions of a file. In addition to comparing different versions of a file, VCSs also allows you to switch between them. VCSs can either be distributed or centralized. Let us see how these two types differ.
Centralized version control systems use a single, centralized server to store all the different versions of a file. Users can access these files by gaining access to this centralized server. Now, there is a disadvantage associated with this type of VCS. If the central server fails to function due to any reason, the entire history stored on its will be gone and no one will be able to recover any version/versions of the lost files.
Distributed version control systems have an edge over their centralized counterparts. These VCSs store file versions in two locations – the centralized server and your local machine. So, the disadvantage that we discussed centralized systems doesn’t exist in distributed systems.
Even if the server undergoes failure, you can retrieve all the different versions of your files from your local machine. Suppose you have a file, which is called VersionControl1. Now you made several changes to this file and saved the changes on each occasion. All the changes that you made to this file will be stored in the VCS, which will have all those versions of this file when you made changes to it.
What is Git?
You may have come across people who are under the impression that Git is a programming language. The truth is that it isn’t a programming language rather a distributed, open-source version control system – one of the most preferred VCSs at that.
Version control systems have a big role to play when it comes to tracking changes to the files that happen to be a part of a bigger project than usual. As already discussed, VCSs store different revisions or versions of your files. You can review these versions whenever you want and restore an older version of a file if the changes you made to it didn’t work well. VCSs are very useful when it comes to tackling different issues with your code or a version of it. You can access your code’s older versions to find out the error and when it originated.
The origin of Git is quite interesting. As everybody knows, it was developed by Linus Torvalds, the creator of Linux. Now, the idea of creating Git or anything on similar lines emanated from a necessity. Linux had been using BitKeeper, a version control system, for almost all their projects. Now BitKeeper decided to shut the availability of the free version of the system. Linux’s need for a replacement turned into a need for creating a free, open source version control system. It took them less than a year to come up with the maiden version of Git.
Git is a distributed VCS so it works on your local machine while storing all the versions of the files that are already stored in your computer, on a remote server or repository. It is compatible with Windows, Mac, and Linux. It functions independently, so it neither requires hosting or internet access.
Every Git project has three different sections. These are the Git directory, working directory, and cache. The first section has all those things (metadata and compressed files) that the VCS requires to track how your project is progressing. The second section, which is the working directory, is where the actual work is done. The changes and updates made to files take place in this section. The cache contains the data that is going to go for the next project commit. These sections correspond to three stages of a project – modified, staged, committed.
Git has several benefits. It helps developers save their time and let them experiment without having to worry about errors coming in the way of their progress. Branching is one of the many features of Git that make it the most popular choice of developers across the world. Branching allows developers to detach from the project without requiring you to write a separate code copy of their own. Branching isn’t unique to Git. Other VCSs too have this functionality. However, Git makes it lighter and faster.
Now branching is very useful when you have a prototype that you are looking to try without impacting the original source code in any way. Projects that are handled by different teams find this functionality more beneficial. It is a distributed VCS so every member of a team will have it on their machine.
There could be instances where all the members of the team set out to modify the code all at the same time. This could lead to a lot of issues. This is why branching is so important. When each member is working on their respective branch, the chances of any issues coming up are very less. The contribution that each member makes through their branches can be marched into the source code.
Other version control systems that are somewhat similar to Git are SVN and Mercurial amongst others. Git is still quite unique, and its uniqueness lies in the way it stores different versions of files. It doesn’t have a list of files but snapshots. Every time you make changes to a file and save those changes, it takes a snapshot and references it for future needs. In case you didn’t make any changes to the file, the reference will take you to the version highlighting the previous revision.
Also read: Git interview questions & answers
What is GitHub?
Now you understand how Git works and what role it plays in the whole software development cycle. Let us now discuss where GitHub fits into the entire version control and management scheme of things. It is a version control web hosting service that uses Git. It comes with all the features and functionality of code management and version control.
GitHub allows developers to host their repositories online and collaborate with members of their team while working together on a project. All that’s required to use it is a desktop UI or web portal. Even Git-shell commands would work.
Committing happens in the same way as it happens in Git. However, there is one difference. Once you commit all the changes, you can let the other members of your team view those changes and work simultaneously on a project by pushing the changes online. So, GitHub is nothing but a location where all your repositories are stored.
This is your repository center if you like, and you just need an account to start working on a project. Once you have a GitHub account, you will know how great it is. You will huge storage space as well as profile to reckon with. Repositories stored on GitHub are originally public, but if you want you can turn private too.
The GUI of GitHub is such that it allows you to create repositories and perform operations at a faster pace. You can host a project in different programming languages using GitHub. There are three features that make it so powerful. These are:
1. Fork: It is the process that involves the copying of another developer’s code from a repository to make changes to it.
2. Pull: The pull request allows a developer to share the changes that they have made to another developer’s code with that developer.
3. Merge: Original developers whose codes were modified can use merge to add those changes to their project. They can even credit the contributors.
Difference between Git and GitHub
GitHub makes collaboration easy with Git. It is a platform that allows multiple developers to work on a project at the same time. It allows developers to see edits made to files by other developers in real-time. In addition, it also comes with project management and organization features. Setting permissions, assigning tasks, using comment moderation, and other things become so much easy with GitHub.
As we had already mentioned, GitHub repositories are public. So, it is easy for developers from different parts of the world to collaborate and contribute in a way that improves the original code. This, in a way, makes it a networking site for developers.
GitHub is a great tool for new developers to build their CVs. They can gain valuable experience by working with some of the best developers across the world. They can even share their projects on their profiles and keep a record of others that they have contributed to.
Git helps you learn the basic functionality of version control while GitHub lets you expand its usage. GitHub is far easier to use with its graphical interface, task management, and version control tools. You can even add more features to your project with the help of GitHub Marketplace. It is very helpful in debugging, localization, and automatic code analysis amongst other tasks.
If you’re interested to learn more about Git, Github, full stack software, check out upGrad & IIIT-B’s PG Diploma in Full-stack Software Development which is designed for working professionals and offers 500+ hours of rigorous training, 9+ projects and assignments, IIIT-B Alumni status, practical hands-on capstone projects & job assistance with top firms.