Naming is often an issue in various sectors, and IT is no exception. Some systems get their names based on their origins, some are chosen to highlight the functionalities, and some are purely accidental or chosen to honor a famous pop culture phenomenon. These inconsistencies sometimes result in rather puzzling situations – e.g., it’s not uncommon for a beginner to get confused about the difference between Git and GitHub. They do have very similar sounding names – however, they are two different things. And yet you couldn’t say there’s absolutely nothing joining them. In this thorough Git vs. GitHub comparison, we will introduce you to both of them, highlighting the differences and explaining the relations.
Git: version control at its finest
Rookies sometimes wonder: is Git a programming language? To get it completely right, let’s start with the basics: Git is a widely used tool, known as a version control system.
Version control systems are extremely useful in any bigger project, as they allow you to track changes that occur with every new update. It stores separate versions (revisions) of your code, so you are always free to review them and even restore a previous one if the new functionalities you added recently turned out to be a fail. If a certain issue arises, accessing previous versions of your code makes it easier to find where exactly it originated.
Developed in 2005 by the Linux OS creator Linus Torvalds, Git is completely free and open-source. Its story began when the team of another version control system called BitKeeper announced they’re putting an end to the free version of their software. As the Linux team was using it for their projects, they now needed a replacement. It took less than a year for the 1.0 release to happen, and since then the project has been maintained by Junio Hamano.
Git can be downloaded and used in the local computer environment. It supports most major systems, including but not limited to Windows, Linux, and macOS. It is completely independent and can be used without any hosting services or even internet access. Of course, you can use services like GitHub or GitLab… But more on those later.
Each Git project consists of three sections, called the Git directory, the working directory and the cache. The first one contains everything that the system requires to be able to track the progress of your project (e.g., compressed files and metadata). The working directory is where the magic happens: this is where the user makes project changes and updates. All the data that will be included in the next commit of the project is contained in the cache. Three sections also represent three states of a project: it can be modified, staged, and finally committed.
What sets Git apart
Not only Git saves time for the developer, but it also lets them experiment more freely without fearing a certain error will halt the progress. What helps with this especially is a feature we call branching. In its essence, it is the opposite of merging. Branching allows you to diverge from your project without creating a whole new separate code copy. While branching in itself is not a unique functionality and there are other version control systems that use it, Git excels by making it extremely fast and light in terms of resources.
Branching becomes very handy when you want to try a prototype of a new feature without affecting the main source code. This is especially useful in team projects. Git is a distributed version control system: to work on the same project as a team, all the members would only need to have the Git software. However, just imagine what could happen if everyone tried to modify the same code at once: you’d have bugs and issues aplenty! Now, if each member is working on their own branch, the owner of the repository can verify a well-written and worthy contribution. Then, you can easily merge it into the source code.
The main competitors of Git are Mercurial, SVN, and a few more version control systems. However, Git is unique in the way it stores the version information. Instead of a list of file changes, it has a small system of snapshot streams. Each time you save your progress, Git takes a snapshot of the updated file and keeps a reference to it. If you haven’t changed anything, the reference will simply point to the previous revision.
Moving to the web: GitHub
Nowadays, a lot of developers and even simple users tend to prefer using cloud solutions over local ones. They do have a lot of advantages: cloud environments are fast, reliable and simple to access from anywhere as long as you have an internet connection. It also means you don’t have to worry about losing everything in an unfortunate event of hardware failure ever again. How great is that? This is also where the Git vs. GitHub duel starts.
As for version control, you can choose from multiple online solutions, such as Bitbucket, GitLab or GitKraken. However, GitHub with its whopping number of 40 million users is the ultimate leader of the field. It is an online hosting service that you can use to store your version control repositories (all the files and folders you need to track the project). Apart from the source code, GitHub also supports Git pull requests, version commit history, email notifications, issue tracking, and multiple other features.
GitHub was created in 2008. Ten years later, Microsoft bought it for 7.5 billion dollars. However, it operates as an independent business to this day. Among the companies using GitHub for web development and other projects are Microsoft (of course), Google, Bootstrap, and Node.js. And yes, we use it here at BitDegree as well.
Free GitHub vs. paid
As the basic functionalities of GitHub are completely free to use for registered users, it is a great option for storing open-source project codes. If you want more than the basic functionalities, that will cost you a dime. Well, not an actual dime: the prices start at seven bucks a month. Before 2020, the main difference between a free and a paid account was that free accounts couldn’t have private repositories. That is not the case now. However, they still cannot have branch protection rules, teams of more than three contributors, use GitHub Pages or project wiki.
If you wish to voluntarily donate to a particular project hosted on GitHub, that is also an option: look at GitHub Sponsors, which works in a similar fashion as Patreon. Speaking of the initiatives started by GitHub, we should also mention GitHub Education, which helps schools to teach software development. This includes teacher training, free developer tools, and other great advantages. What this shows is one of the biggest Git vs. GitHub differences: however useful, Git is merely a tool. GitHub, though, is also a community.
Git vs. GitHub: brothers or cousins?
Comparing Git vs. GitHub, you could say GitHub is the Git of the web – a code cloud. Take a closer look at its name, and the purpose will seem rather intuitive: GitHub is literally a storage hub for your Git things. Developers use it to keep the project repositories for easy access and collaboration.
The simplest way to connect Git to GitHub and import your repositories is by using the GitHub Desktop. This open-source version lets you use GitHub in the local environment, linking it with the personal account you registered online. Using GitHub Desktop, you can easily sync the changes made between the two.
If you already have a repository in your online profile, you can easily clone it to the desktop version. After you perform some updates, you will be able to either simply merge them into the main source code (if you are the owner) or issue a pull request (if the project belongs to someone else). You can use the basic Git commands, such as push, pull, commit and fetch in GitHub Desktop as well. However, don’t assume you can use them all: the advanced ones (e.g., revert) are still not supported.
In conclusion, the difference between Git and GitHub is that Git provides the basic functionality and GitHub helps you to expand it. Due to the graphical interface, version control, and task management tools, it is rather simple to use. And if that’s not enough for you, there is also a thing called GitHub Marketplace, which lets you add extra features to your projects, tailoring it to best suit your needs. It can help with localization, automatic code analysis, debugging, etc.
Before you go
As you can see, there can be no Git vs. GitHub battle, because there is no need for a single winner. You don’t need to choose just one and limit yourself to it. Learn to use both Git and GitHub, use their features to simplify your collaborations, and come up with breathtaking projects. The world is your oyster!