Skip navigation
GitHub logo next to the words "Why GitHub" visible on display screen Alamy

What Is GitHub and What Is It Used For?

Here's what programmers need to know about GitHub — how to get started with GitHub, its benefits, and best practices.

If you had to pick the single most important platform for developers to know today, GitHub would be a good choice. Although using GitHub — which reports more than 83 million active users as of 2022 — is not strictly required for modern programming, GitHub (along with a handful of similar, competing platforms) has become the de facto hosting service that programmers use to store and share software they write.

This article breaks down everything modern coders need to know about GitHub — including how it works, what its benefits are, and how to use GitHub as a version control and source code management solution.

How Does GitHub Work?

GitHub is a platform for hosting software. It's designed primarily for hosting source code, meaning the "raw," uncompiled code that is used to build applications. You can also upload, store, and share binary files (such as compiled applications or images) on GitHub if you wish, but it's more common to use binary repositories for this purpose; for example, if you want to store and distribute container images, you could use Docker Hub.

Related: How to Use GitHub Personal Access Tokens

GitHub's core features include support for:

  • Storing source code
  • Tracking changes to source code over time
  • Sharing code with other developers or end users, if desired

GitHub provides these features by allowing programmers to configure repositories. Typically, each repository is dedicated to a specific software project; for example, if you're building multiple applications, you'd generally create a separate repository for each of them. You can then upload and store the various files associated with each project — source code files, configuration data, documentation, and so on — in the repository. Whenever you modify a file or replace it with a new one, GitHub automatically keeps track of the version changes.

Because GitHub is hosted on the internet, it can be accessed from anywhere. In addition, multiple developers can work on code in the same repository at once — a feature that is beneficial for projects where more than one coder is developing software. GitHub automatically monitors which developers made which changes to data inside repositories, so you get a record not just of how your versions have changed over time, but also who was responsible for the changes. And you can revert changes made by a specific developer, or changes associated with a certain version, whenever you want.

Related: How to Delete a Local or Remote Branch on Git and GitHub

GitHub repositories can be either public (meaning that anyone on the internet can view and download code hosted in them) or private (which means they are available only to specific users). Public GitHub repositories are a great way to host open source code, while private repositories are useful if you want to build software that should be available only to developers inside your organization or a select group of external users.

GitHub vs. Git

Most of GitHub's core collaboration and version control features derive from Git. Git is an open source version control system created by Linus Torvalds (the developer who introduced the Linux kernel) to help programmers manage source code. However, whereas Git is a tool that works only from the command line, GitHub provides a web interface for interacting with Git repositories.

GitHub also provides a variety of additional features — such as Issues, which helps developers track their work, and Copilot, which can automatically generate code using AI — that are not part of Git.

GitHub Competitors and Alternatives

GitHub is not the only web-based, Git-centered code hosting solution. Alternative services, such as GitLab and Bitbucket, provide approximately the same functionality. The main differences between these services and GitHub lie in which add-on features they provide beyond core Git functionality.

Related: GitHub vs. GitLab: Which One Is Better for Your Enterprise?

Public clouds also offer services that are similar in some ways to Git — for example, Azure Pipelines lets developers manage and deploy source code, among other features. However, because these services aren't designed to make it easy to share code with the public at large, it makes more sense to use them when developing proprietary software, rather than code that you want to be publicly accessible.

You can also set up your own GitHub-like environment by deploying a Git server and installing a web front end, like GitWeb, to interact with it. This requires more effort than using GitHub, where the underlying infrastructure is provided for you and you can launch repositories with just a few clicks. But setting up your own Git server provides more control because you fully own the host infrastructure, and you can configure the software in any way you want.

What Are the Benefits of Using GitHub?

There are many reasons to take advantage of GitHub:

  • Social coding: GitHub is sometimes called a social coding platform because it lets developers collaborate easily when building software. Even if you don't specifically need to collaborate with other coders, sharing your code on GitHub allows other developers to inspect, download, and (if you give them permission) even modify your code, if they wish.
  • Version control: As noted above, GitHub automatically tracks versioning changes to code.
  • Code review: GitHub makes it easy to review your own code, as well as code written by others. You can leave comments to explain why you made a certain change, for instance, or suggest a way to improve code.
  • Code sharing: By configuring public repositories, you can use GitHub to share code with anyone who may want it.
  • Documentation: Although GitHub isn't a complete documentation tool on its own, developers can use it to manage documentation files in addition to code.

What Are Some of the Features of GitHub?

We touched on GitHub's core code hosting, sharing, and collaboration features above, but let's take a deeper look at how GitHub's features work.

GitHub for version control

Version control is a standard GitHub feature that is enabled by default, for free. Using version control, you can view changes to code over time. Each change (or set of changes) is known as a commit, and you can track how your code evolves as various developers make commits.

Beyond being able to see how your code has changed, you can use GitHub version control to revert to an earlier version of your code if you introduce a change that causes a bug, for example. You can also make multiple versions of your software available at the same time, which is useful if, for instance, some of your users want to run the "beta" version of your application while others prefer a fully tested, stable version.

Collaboration and social networking for developers

Although it would be a stretch to call GitHub a social media platform in the traditional sense of the term, it offers collaboration features that help developers network with each other.

Developers can, for instance, search through GitHub to find projects — and the programmers associated with them — that are of interest to them. Developers can also configure GitHub profile pages to share information about themselves. And, although you can't send messages directly through GitHub, it's a common practice for coders to share their contact information on their GitHub pages so that others can contact them if they wish.

In these ways, GitHub can help boost developer productivity and satisfaction by helping coders work together based on shared interests.

Web-based version control

GitHub provides a convenient way of managing code through a web interface.

As noted above, most of GitHub's core functionality derives from Git. Functionally speaking, most of the things you can do in GitHub could also be done using Git on a command line.

However, it can be challenging to use Git on the command line when you have dozens of repositories to manage and multiple developers working across them. By allowing developers to view the contents of repositories, open up individual files, track changes, and much more directly through a web browser, GitHub provides convenience. It also makes version control more scalable.

Distributing code

GitHub is a great solution not only for making code available to end users, but also for developers who want to share their code with other developers in order to invite their feedback or ask them to collaborate.

GitHub is particularly useful for managing open source projects, since open source coders are typically eager for the community at large to build and use their code — and for outsiders to contribute to their projects, if they have the inclination.

That said, GitHub isn't strictly just for open source projects. You can also set up private repositories if you want to manage proprietary code in GitHub.

Note, too, that although GitHub is widely used for hosting open source projects, most of the code behind GitHub itself is not actually open source. For that reason, developers who are ideologically committed to open source software — who, in other words, believe that software should be open source as a matter of principle — may prefer to use a GitHub alternative that is fully open source, like GitLab.

How to Get Started with GitHub

The process for getting started with GitHub is simple. Here are the basic steps:

  1. Create an account. Join GitHub by configuring a username and password.
  2. Choose a plan. You can set up an account with basic features and quotas for free, although GitHub paid plans are available if you want enhancements like added storage.
  3. Create a repository. With an account set up, you can set up your first repository by clicking the + button in the upper-right corner of the GitHub interface and selecting New project.
  4. Fork a repository. A repository fork is a copy of an existing repository. If you want to work on someone else's code (or code that you host in one of your own repositories) without changing the original code, you can create a fork. To fork a repo, click the Fork button on the repository you want to copy.
  5. Make a pull request. If you want the authors of a repository to integrate changes you've made to their code inside a forked repository, you can submit a pull request by clicking the Pull request button.
  6. Watch a repository. To get updates whenever a repository changes, you can "watch" it by setting up a repository subscription.

Resources for Learning More About GitHub

Unsurprisingly given that GitHub is a widely used platform, there are a variety of resources you can leverage to learn more about it.

One of the most important is the GitHub blog, where you'll find announcements about the latest GitHub feature releases and changes, as well as guidance and perspective on getting the most out of GitHub.

Related: How to Get the Newest Google Snake Mods on GitHub

If you run into trouble using GitHub, start troubleshooting on the GitHub help site, which is designed to help users resolve challenges. If that fails, you can ask a question in the GitHub community forum.

To dive deeper into GitHub's features and become an advanced user, you can take courses on GitHub Learning Lab. There are also, of course, a large number of free guides and resources available from YouTube and other third-party sites, although they vary in quality. For the most reliable content, stick with well-known, official sources — like GitHub's own YouTube channel.

Best Practices for Getting the Most Out of GitHub

You should check out the resources described above for full details on GitHub best practices. But if you're new to GitHub, some basic best practices to keep in mind include:

  • Create a repository for each project: Although it may be simplest to create one repository for all of your code, projects are much more manageable if each one has its own repository.
  • Test before making pull requests: Before you submit a pull request, carefully vet your code to increase the chances that the developers you're submitting to will accept your request.
  • Use descriptive commit messages: Whenever you make a change to code in GitHub, include a comment explaining why you did it. Other developers — not to mention your future self — may want to understand your thinking.
  • Don't use GitHub as a backup service: Although you technically could store data that you want to back up using GitHub, that's not what GitHub is designed for. It's also not especially cost-effective for large-scale data backup storage. Use a dedicated backup storage platform if you need to back up information.
  • Don't use GitHub to host binaries: Likewise, GitHub is not intended to be a place to host application binaries. Store those in a binary repository or container registry, and use GitHub for your source code.

Why Start with GitHub

GitHub is not the only platform of its kind, but it is one of the most popular solutions today for hosting source code. It's easy to use, it supports both public and private repositories, and it's free of cost for most projects that operate on a small scale. If you're looking for a way to host your code and collaborate with other developers, GitHub is an excellent place to start.

About the author

Christopher Tozzi headshotChristopher Tozzi is a technology analyst with subject matter expertise in cloud computing, application development, open source software, virtualization, containers and more. He also lectures at a major university in the Albany, New York, area. His book, “For Fun and Profit: A History of the Free and Open Source Software Revolution,” was published by MIT Press.
Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish