How to create a pull request on GitHub

I use git mostly as a backup mechanism. Meaning I just write

git commit -a -m 'yep'

as if it was some kind of magical incantation, without really understanding what it means.

I push some of my code to GitHub as well, mostly in private repos as a kind of "extra backup" in case our house is destroyed in an earthquake.

Green GitHub squares make me happy

There is a magical spell which makes the little squares light up.



Recently a friend of mine asked whether I might want to help out with an open source project called Libscore, a service which spiders websites to discover the most popular JavaScript libraries.

Libscore stats for Angular

I haven't really used Git or GitHub to collaborate with anyone, but was eager to give it a shot.

First attempt at submitting a contribution

I started browsing the Libscore project on GitHub and clicking around on the website until I found a bug I could fix. In this case a button that needed to be removed, as it was no longer working.

My first attempt was to start by cloning the project to my local computer.

git clone

Great, that seemed to work. Next I opened the file in question in my editor of choice Sublime Text and made the very challenging fix of commenting out a single line of code.

After having the fixed code on my computer, I somehow needed to get it back to the project on GitHub. I thought maybe I should invoke that old spell again.

git push origin master

But alas, it had no effect. I guess that makes sense. If anyone could just push code to any repo, civilization would descend into anarchy.

You damn, dirty octocat

If I can't push, maybe they need to pull?

OK, so to avoid having to live in a world where I might have to resort to cannibalism to survive, there needs to be some mechanism where the owner of the repo has to agree to the change.

I do remember hearing that there's such a thing as "pull" as well. Somehow they need to pull the code from me. But how would that work, my computer is not a permanent server. It's almost as if I need some kind of external hub for Git.

GitHub is a hub for Git

I can fork the repo, clone that locally, make the change, push the change back to my own repo, then somehow ask them to pull in the change!

Steps in ultra slow motion

The first step was to just press the "fork" button. That was painless.

Now I have my very own fork:

I used the clone spell again to get a local copy of the new fork.

git clone

Next I saved the world through my amazing programming skills.

To put my change back into my own fork on GitHub I invoked my favorite spell:

git push origin master

For some reason it asked for my username and password, which it doesn't usually do, but after providing them the push went through.

The feeling of satisfaction is relative to how much I suck.

Creating a pull request

Now I had the change in my own repo, but wanted to request Libscore to pull it into theirs.

Clicking the "new pull request" button revealed the following mystery screen:

Sorry, wrong screenshot there. Actually it was this screen:

After getting over my despair of possibly having to pour over hours of Git tutorials before being able to proceed, I noticed a link with some familiar sounding words: "compare across forks".

Across forks?

I have a fork.

Maybe this is what I need? So I clicked it, chose my fork and...

This looks promising! I clicked on the invitingly green and shiny "Create pull request" button.

I put forward some of my best prose and submitted.

And the award for the best pull request goes to...

Thanks for reading

This was a work of fiction. I wouldn't actually be this clueless, would I? Ha ha... ha! Any resemblance with actual pull requests is purely coincidental.