Demystifying The Differences Between Git & GitHub
If you have worked with codes then you must have come across the words like Git and GitHub. It is also possible that you might have used them as well. But do you know what exactly is Git or GitHub and how they are different from each other? Well, if you don’t, no worries! It’s never late to learn new stuff nor its that tough in this case. In this article on Git vs GitHub, I will be giving you a complete insight of both.
Following are the topics I will be discussing in this Git Vs GitHub article:
- Version Control
- What Is Git?
- What Is GitHub?
- Git vs GitHub
To understand the exact difference between Git and GitHub you first need to know about version control. So, what do you understand by the term version control?
Version Control
The term Version control refers to a system that records changes to a file or set of files over time called the ‘versions’. In other words, these versions will help you in tracking the changes in your codes/project and if necessary, undo those changes as well. This feature of being able to compare, differentiate and revert changes between two versions of a particular project becomes really helpful when working on a larger project. Larger projects mean more people working on the same code which increases the chances of conflicts. Using version control you can easily prevent these conflicts.
This system which controls the versioning of the codes is called a Version Control System (VCS). For a better picture, you can think it as a ‘database’. Within this database, VCS takes snapshots of your entire project and stores them as versions. Now with the help of these snapshots, you can easily compare the versions and switch between them as per the need. Check out the below picture which shows the entire process:
I think now you clearly understand the concept of version control. One thing I would like to mention here is, don’t get confused between a VCS and a backup/ deployment system. This VCS totally eliminates the need for changing or replacing the tool chain completely unlike the backup systems. Below I have listed few of the advantages of using version control:
- Version control creates proper workflows which help in preventing the chaos among people using their own development process with different and incompatible tools.
- Each version has a description of what the changes in this version are done. These descriptions help in tracking the changes in the code by version.
- VCS synchronizes the versions and ensures that your changes don’t conflict with others using the same repository.
- VCS helps in keeping the history of changes as other people save new versions of your code. This history can be reviewed to find out by whom, why, and when changes were done.
- The VCS automation features save yours as well as your teams time and generate consistent results by performing testing, code analysis, and deployment whenever any new versions are saved.
So now let’s proceed ahead with this article on Git vs GitHub and understand what exactly is Git.
What Is Git?
Now that you know about the version control, it will be really easy for you to understand about Git. So, what is Git?
Git is a version control software which you need to install on your local system in order to use it. For an individual working on a project alone, Git proves to be an excellent software. But what if you are working on a project with a large team. All will be working on the same project but each of you will be having a different version of the same project. Suppose you have made changes in the project directory on your machine and you want to send those changes to your collaborators. Also, you want the changes they make to appear directly in your machine’s project directory. As working on a project, being on the same page with your teammates is very crucial to avoid any type of conflict. So, how you will do that? Well, no worries Git takes care of all but the only condition here is, each of your team members must have Git installed on their systems.
Git also is known as distributed version control system which means using Git you can push and pull yours as well as others changes to other people’s machines:
Now, using Git you can work on the same copy as your team member. But the copy on which you will be working, won’t reflect any of the changes in the main directory unless and until you pull your collaborator’s changes and push back your own changes.
In today’s market, Git is the most widely and popularly used modern VCS. It is quite matured and is a well maintained open source project. It was developed back in 2005, by Linus Torvalds who is also the creator of Linux OS kernel. If you check the above picture of the Google trends result, you will find that Git has continued to grow in the market since 2005. A varying number of software projects, including commercial as well as open source, completely rely on Git for their version control. So, how Git is different from the rest that makes it so popular?
The major difference between Git and any other VCS like Subversion (SVN), Mercurial, TFS, Perforce, Bazaar etc., is the way Git stores its data. In other systems, information is stored as a list of file-based changes which is also known as delta-based version control. But in case of Git, it stores its data in the form of a stream of snapshots of a miniature file system. With Git, whenever you commit or save the state of your project, a snapshot is taken of the present file state and a reference is stored for it. If no changes or updates are done then Git stores a link to the previous file that it has already stored. Following diagram shows how Git stores the versions:
But Git will only be helpful when you know when is your collaborator’s system is turned on and is connected to a network. So what will you do when your team members are not online? In these situations, a third party having an identical copy of your project, from where you can easily push and pull the changes, will come in handy.
Well, you will be glad to know that, this is what GitHub does and in the next section of this article, I will explain all about it.
What Is GitHub?
As told, Git is a version control system which tracks the changes when working with computer codes while GitHub is a Web-based Git version control repository hosting service. It provides all of the distributed version control and source code management (SCM) functionalities of Git while topping it with a few of its own features. It is a heaven for the developers where they can store their projects and get connected with like-minded people. You can think it as “cloud for codes”.
So basically it is a place to store your identical working directories or repositories. It literally is a hub for the Git repositories which you can use, simply by creating a free account on the GitHub. These accounts come with an abundant storage space where you can store your repositories and build a proper profile which holds a great value. By default the repositories are public i.e., everyone can see your codes but you can make it private as well. So if you are a good coder you can upload your own applications and programs and get recognition from others.
It works along with the collaboration of Git. While Git is a command line tool, GitHub is a Web-based graphical interface which provides you with the access control, basic task management tools along with several collaboration features. Moreover, GitHub can host your project’s source codes in various programming languages and keep the track of the each of the changes made to every iteration. GitHub’s functionality doesn’t end here. It provides following 3 extraordinary features which makes it so powerful:
- fork: Or commonly known as forking is copying a repository from one user’s account when you don’t have the write access to it. So you can just copy it and modify it under your own account.
- pull: When you have made the changes in codes that you have copied and want to share them with its original order. Then you can send a notification called a “pull request” to them.
- merge: Now the user who is the owner of those codes, if, finds your changes relevant can merge the changes found in your repo with the original repo, by just button click.
If your pull request is accepted by the owner then you get its credit on the original site and shows up in your user profile. It is a kind of a resume that helps the GitHub project maintainer to determine your reputation. So, more the people and projects on GitHub, the better idea a project maintainer gets of its potential contributors. This encourages the young developers and projects to grow more in the industry. I hope now you understand what is Github. So let me now summarize the basic differences between Git and Github.
This concludes this article on Git vs GitHub. Hope you enjoyed reading this article and learned something new. If you wish to check out more articles on the market’s most trending technologies like Artificial Intelligence, Python, Ethical Hacking, then you can refer to Edureka’s official site.
Do look out for other articles in this series which will explain the various other aspects of DevOps.
2. Git Tutorial
9. How To Orchestrate DevOps Tools?
13. Continuous Delivery vs Continuous Deployment
14. CI CD Pipeline
15. Docker Compose
16. Docker Swarm
18. Ansible Vault
19. Ansible Roles
20. Ansible for AWS
21. Jenkins Pipeline
22. Top Git Commands
24. DevOps Interview Questions
27. Git Reflog
29. Top DevOps Skills That Organizations Are Looking For
31. Maven For Building Java Applications
34. Ansible Interview Questions And Answers
35. 50 Docker Interview Questions
37. Jenkins Interview Questions
40. Linux commands Used In DevOps
42. Nagios Interview Questions
Originally published at https://www.edureka.co on December 11, 2017.