How To Contribute To A Project On Github
Nov 11th, 2011This 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.
-
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
-
Clone your fork git repository on your local computer:
git clone git@github.com:YOUR_USERNAME/wordpress-on-dotcloud.git
-
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
! -
Do your trick, make your patch, change the code, fix a bug, have a coffee, add a cool feature, etc.
-
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.
-
Push your new branch to github:
git push origin my-awesome-patch
-
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”. -
Check the diff, write a message explaining what you have done and why the repository owner should accept your pull request and submit.