Once you know how to make commits, push to a GitHub-hosted remote, and clone a pre-existing repo, you're most of the way to submitting a pull request.

Pull requests are GitHub's way of modeling that you've made commits to a copy of a repository, and you'd like to have them incorporated in someone else's copy. Usually the way this works is like so:

  1. Lady Ada publishes a repository of code to GitHub.
  2. Brennen uses Lady Ada's repo, and decides to fix a bug or add a feature.
  3. Brennen forks the repo, which means copying it to his GitHub account, and clones that fork to his computer.
  4. Brennen changes his copy of the repo, makes commits, and pushes them up to GitHub.
  5. Brennen submits a pull request to the original repo, which includes a human-readable description of the changes.
  6. Lady Ada decides whether or not to merge the changes into her copy.

Let's walk through a basic pull request using a very simple repo called Adafruit-Git-Intro.

Get a Copy to Work On

Notice that little "Fork" button up in the corner? Click that:

You might be asked where you want to fork the repo. In this case, I'm forking it to my personal account instead of to the account for any of the organizations I'm a member of:

...and here's my personal copy, which can be cloned from

Make Some Changes

As an example, I'm going to make a pull request for a file called contributors.md, with a list of people who have contributed to the repo. I'll add my name to the top - when making your own pull request, you can add yours to the list.

nano contributors.md

Add a line with your name and hit Ctrl-X to exit and save, and check the status:

Now make a commit:

git add contributors.md
git commit

...and push your new commit back up to your copy of the repo on GitHub:

Submit the Pull Request

Now have a look at the repo on your GitHub account. You should see a notification that your master branch is 1 commit ahead of adafruit:master (here, mine is actually a couple ahead, since I've been messing with some other things). Look to the right side of that notice, and you'll see a "Pull Request" link. Click it.

Now you should be looking at a comparison of your repo and the official Adafruit copy, with your commits and additions shown:

Go ahead and click the big green "Create Pull Request" button. You'll get a form with space for a title and longer description:

Like most text inputs on GitHub, the description can be written in GitHub Flavored Markdown. Fill it out with a description of your changes. If you especially want a user's attention in the pull request, you can use the "@username" syntax to mention them (just like on Twitter).

GitHub has a handy guide to writing the perfect pull request that you may want to read before submitting work to other repositories, but for now a description like the one I wrote should be ok. You can see my example pull request here.

That's pretty much it! From here, the owner of the repository (in this case, the people with access to Adafruit's GitHub account) can comment on individual changes or the entire pull request, and choose to accept or reject the request. They may have questions for you, suggestions for improving your changes, or feedback on your overall goals.

This guide was first published on Jul 15, 2015. It was last updated on Jul 15, 2015.

This page (Submitting a Pull Request on GitHub) was last updated on Jul 06, 2015.

Text editor powered by tinymce.