Why Contribute to GitHub?
GitHub is an online repository hosting service where you can host your own projects, and contribute to projects created by other people.
There’s many reasons why you might decide to contribute to one of the many open source projects hosted on GitHub. Maybe you’re a fan of the project in question, or just open source in general, and want to give something back to the community; maybe a project contains a bug that you know how to fix; or maybe you’ve come up with an idea for a great new feature, and want to share it with others.
Whatever your motivation, this tutorial contains everything you need to know, to start contributing to your favourite GitHub project.
What You’ll Learn
Over the course of this tutorial, you’ll learn how to ‘fork’ the repository that contains your chosen project. When you fork a project, you create a GitHub-hosted copy of the original repository; however, since this copy only exists on GitHub, you can’t work on it directly. To get around this problem, you’ll learn how to create a local clone of your fork. You can then make whatever changes you want to this local clone, from the comfort of your own computer.
Once you’ve finished working on your clone, you’ll bundle all your changes into a commit, and then push this commit to your fork. Finally, you’ll ask the project’s owner to apply your changes to their original project, by sending them a pull request. If your pull request is accepted, then your changes become part of the project.
Making Your First Pull Request
The following steps show you how to make your first contribution to a GitHub-hosted project, using GitHub’s demonstration repository, “Spoon-Knife,” as an example.
Note, this tutorial requires a GitHub account, and for you have to have installed Git. When you communicate with Git, you enter all commands into the Terminal (if you’re a Mac user), or the Command Prompt window (if you’re a Windows user).
1. Fork and Clone the Original Repository
Navigate to the repository of the project you want to contribute to. For the purposes of this tutorial, this is the Spoon-Knife repository: