OpenTechSchool

Github from Scratch


Home Introduction

Part I: Learning to sail

Part II: Sail away!


Wall of Fame Find more treasures

Part 2: Sail away!

Social Coding

So, here you are, with your cool project code online, fully versioned and everything. Well, coding on your own can become boring after a while - but we are here to help!

Challenge

Find a peer, fork her repository and add changes by submitting a pull request!

How to do it

You should know that GitHub is not only the host of your code, it also makes collaboration easy. There are two ways to contribute to other people's repositories.

One is to add a user as collaborator to your project, which grants them full access. They can then commit and change directly in your repository. This is great when you know them well and really trust them not to mess with your project.

Before we take a look the second way of collaboration on GitHub (which is much safer) you need a partner in crime.

Task: Find a partner

To find someone to share your code with, take a look around you. See that person looking around, just like you? Approach them in a non-threatening way (smiling may help) and ask nicely.

Now get ready to fork.

Forking is GitHubs name for making an exact copy of someones repository and putting it into your account. That way you can make any changes you want, it is your code now (aside from copyright of course). The original owner will get a notice about your fork, and when viewing the copied repo in your account, it will show as "forked from" them, so everyone knows who invented that crazy code originally.

So, go ahead and fork your coding buddy's repository. Don't be shy.

Make changes

You can change files, fix spelling mistakes, add a joke to their homepage or whatever you find appropriate.

You surely have noticed that this isn't really collaboration yet, because when you start making changes the original repository will not be affected. To truly contribute to your partner's project there is more to do.

Make a pull request

A pull request is basically GitHubs way of saying "Hi, I made changes and I think you should add them to your repository". If your request is accepted, all changes will be merged into their repository and marked as contributed by you.

On the project page in your account, among the icons on the right side there is a button for pull requests. Click it and then the green button saying "New pull request". You will see a comparison of the files you changed, to review and make sure you will only submit the stuff you want to.

After you click on the area that says "Click to create a pull request for this comparison" you should describe your changes and ask the repository owner to kindly accept your changes into their code. If you feel especially bold, you can add the image of a cat into your message, using markdown syntax (github flavored). Try adding this as a comment:

![A cute cat!](http://placekitten.com/g/200/120)

Accept a pull request

If you are the one receiving a pull request, you will be notified by GitHub. You can review the changes, read the request comment and go all awwwwww on cute cat images. After that, don't forget to merge the changes into your repository.

Now you are ready to dive into the social part of GitHub. Go on and find more people to fork from and collaborate. Be social! When you feel comfortable with forking take a step to the Wall of Fame.


By the way, this chapter is a very very condensed version of the OpenTechSchool course "Social Coding with GitHub". Yes, one can spend a whole day just with fun things like these... but for now please stay with us, ok? We'll link to that course on the "Find more treasures" page.