How To Contribute To A Project On Github

🦖 This post was published in 2011 and is most likely outdated.

This is a step-by-step tutorial going through how to easily submit a patch to a github project.

I assume you have already an account on github. Let’s say you want to contribute to Wordpress on Dotcloud.

  1. Make your own working copy of the project by forking it: go on the project page (http://github.com/qpleple/wordpress-on-dotcloud) and click “Fork”. You can access you copy at: http://github.com/YOUR_USERNAME/wordpress-on-dotcloud

  2. Clone your fork git repository on your local computer:

     git clone git@github.com:YOUR_USERNAME/wordpress-on-dotcloud.git
    
  3. Create a new branch for your patch:

     git branch my-awesome-patch
    

    This is very important, create one branch per patch. And never submit a patch that has been done on the branch master!

  4. Do your trick, make your patch, change the code, fix a bug, have a coffee, add a cool feature, etc.

  5. When you are done, commit your changes:

     git add -u
     git commit -m "fixing this broken feature"
    

    Try to keep commit message short, less than 100 characters.

  6. Push your new branch to github:

     git push origin my-awesome-patch
    
  7. Go on your fork page (http://github.com/YOUR_USERNAME/wordpress-on-dotcloud), then select my-awesome-patch in the branch list and click “Pull Request”.

  8. Check the diff, write a message explaining what you have done and why the repository owner should accept your pull request and submit.

Comments