GitHub: What is it and why we use it in the dev community.

At a high level, GitHub is a website and cloud-based service that helps developers store and manage their code, as well as track and control changes to their code. To understand exactly what GitHub is, you need to know two connected principles:

  • Version control
  • Git

What is Version Control?

Version control helps developers track and manage changes to a software project’s code. As a software project grows, version control becomes essential. Take, for example, Facebook. It has thousands of developers working on it at a time, but none of them are rewriting each other’s code. Is it the result of magic? No, its Version Control. Version Control ensures an application has one working, or “master”, version at all times. It wouldn’t be safe or efficient for every developer to be able to edit the master source code.

Instead, Version Control is used so that each developer can take a copy (AKA a branch) of the master source code. The developer can then safely make changes to that part of the code without affecting the rest of the project. Those edits are then submitted to a manager who then incorporates their code into the master version (AKA merging). All of the changes made to each file are tracked, and can be reverted later if need be.

What is Git?

Git is a specific open-source version control system created by Linus Torvalds in 2005.

Specifically, Git is a distributed version control system, which means that the entire codebase and history is available on every developer’s computer, which allows for easy branching and merging.

Why do we use GitHub?

GitHub is a for-profit company that offers a cloud-based Git repository hosting service. Essentially, it makes it a lot easier for individuals and teams to use Git for version control and collaboration.

GitHub’s interface is user-friendly enough so even novice coders can take advantage of Git. Without GitHub, using Git generally requires a bit more technical savvy and use of the command line.

GitHub is so user-friendly, though, that some people even use GitHub to manage other types of projects — like writing books.

Additionally, anyone can sign up and host any number of public repositories and a limited number of private code repositories for free, which makes GitHub especially popular with open-source projects.

As a company, GitHub makes money by selling hosted private code repositories, as well as other business-focused plans that make it easier for organizations to manage team members and security.

How to Use the GitHub Interface

To give you a basic understanding of what the GitHub interface looks like, here’s the source code for a small project of mine.

Project Source Code

From here, you can view the various branches that are being worked on, as well as when someone made a commit. Commits are important because they give a summary of what has been changed on the file. They are similar to saving a file in Microsoft Word, but more informative. Depending on how a repository is set up, you also might be able to create your own branch and make your own commits there.

View Branches

When you’ve made some changes, you could submit that code back to a branch by making a pull request. A pull request is basically asking the person in charge of the branch to include your code. And it also helps that person see exactly what you’ve changed in the code.

If you wanted to edit some or all of the source code on your own account on a more permanent basis, you could also fork it by clicking the “Fork” button up in the right hand corner. A fork is similar in concept to a branch, but a fork copies the repository to your own GitHub account, allowing you to work on it in a more permanent way.

How To Get Started With GitHub

To get started with GitHub: