What is Git?
Git is a distributed version control system (or VCS), typically used to track files changes. It was developed in 2005 by Linus Torvalds, the creator of the Linux kernel. Git’s primary use is to keep track of changes within source code during the software development process. Source Code Management or SCM was the primary reason for its creation.
Git is not the only available VCS, but it certainly is the most popular ones. This is primarily due to it being a free, open-source, multi-platform, highly integrable, and relatively simple platform to use. In this article, we will learn a bit about version control systems and what Git and GitHub are. We will also review how they work together. At its core, a version control software allows us to keep track of code changes. This way, we can see and evaluate the differences between multiple iterations or revisions of files.
Here is a typical use case. Let’s say we created a website and it’s working fine, even after a few updates! One day, we make some small changes to the site, and suddenly, it breaks. Typically, we would have to remember all the changes we made in the previous update. Then, go back and revert them all manually. Git, on the other hand, shows us exactly what changes we made including which files. This makes it much easier to track down the problem. We could also directly reverse the earlier changes and revert any updates which may have caused the issue. To accomplish this, Git uses repositories.
What is a Git Repository?
A Git Repository (or repo, for short) is essentially the folder where our project is located. It also includes a .git directory containing all of our project files’ revision history. There are two types of repos:
- Local repository — This folder contains all the files on our local computer where we do our work.
- Remote repository — This is an off-site repository. It is usually located on the server where our project lives. It may also reside on a repository hosting service like GitHub.
Using remote repositories is one of the critical functionalities of Git. It expands on its use as a VCS and turns it into a collaborative tool. Complex projects usually have multiple people working on them. A remote repository stores our shared project code in one location. Additionally, it also keeps track of who made what changes and when.
We mentioned earlier that Git is a distributed VCS. To explain this concept, we need to take a look at two other types of version control systems:
- Local VCS: This is the earliest and most basic form of VCS. Usually, these are simply a database that keeps track of changes made to a set of files on a local computer. These do not work very well when multiple developers are working on a project.
- Centralized VCS This is a step up from a local VCS. The project and its version database are kept in a single location, typically on a server. Collaborators can “check out” the files they need to work on. This is similar to checking out a book from the library. Assuming libraries allowed you to modify and update the contents of a book.
However, should the central server become unavailable or fail, the whole project is halted or lost. Unless a backup system is in place, distributed VCS’s come into play. Using Git or another DVCS, each user’s local repository contains a full copy of all the project files. It also contains the entire revision history. Every user has a complete backup of the data. Should any critical failures occur, the project can be quickly restored.
Another essential feature of VCS is branching. Branching is defined as separating work from the main project to modify project code without impacting the main (master) branch. This feature is especially useful when testing and implementing new features, or trying alternative solutions for a problem or task. If that branch is improved, it then will be applied to the master branch, and merged into it. The Git branching system is renowned for being lightweight and quick. In fact, branching and merging is encouraged as part of the workflow.
What is GitHub?
GitHub is a repository hosting service. While we haven’t covered specific git commands or workflows in this particular article, we should note a few critical points:
- Git is a standalone software that needs to be installed. The installation will differ between different operating systems. It is best to check what needs to be done to get Git up and running on our specific system.
- Git is often used via the CLI (Command Line Interface). Both built-in and third-party GUI (Graphical User Interface) tools are also available.
- Another popular way of using Git is directly through a text editor or IDE. Many IDEs natively support Git. Others may require the installation a plugin or adding an extension. A few examples of this are:
- Microsoft Visual Studio
- Visual Studio Code
When working on a project independently, using Git and setting up a remote repository is always a good idea. It is better to have a revisioning system to use as a backup, then to waste time rebuilding lost data.
We should also keep in mind whether we want our project to be publicly available (open-source) or private. GitHub offers both options as a means to either share your code or keep it confidential.
To answer our original question What is the difference between Git and GitHub?
The simple answer is that Git is a version control system which lets us manage and track the history of our source code. GitHub is the cloud-based storage medium which allows us to keep those changes in a remote repository. Using both Git and GitHub together is a sensible choice for maintaining the ongoing development of a code base.
We pride ourselves on being The Most Helpful Humans In Hosting™!
Our Support Team is full of experienced Linux technicians and talented System administrators who have intimate knowledge of multiple web hosting technologies, especially those discussed in this article.
Should you have any questions regarding this information, we are always available to answer any inquiries with issues related to this article, 24 hours a day, 7 days a week 365 days a year.
If you are a Fully Managed VPS server, Cloud Dedicated, VMWare Private Cloud, Private Parent server, Managed Cloud Servers, or a Dedicated server owner and you are uncomfortable with performing any of the steps outlined, we can be reached via phone @800.580.4985, a chat or support ticket to assisting you with this process.