As most of you know, I host most of my projects which I have released as open source in Github. I am open for collaboration and generally accept most of the pull requests that people send me.
Recently I noted that not all people who want to contribute are proficient with git or Github. So here is a small guide to help people who are interested in contributing to projects hosted at Github.
Before we proceed just keep in mind, that this is not the only way to do it. But if you are just starting out using git or Github, then this is a good starting point.
Fork the project in Github
The first step is to fork the project at Github. Go to the project that you want to contribute to and then click the fork button near the top right corner.
Clone the forked project to your machine
When you fork the project, Github creates the forked project in your account. Once you forked the project, you need to clone it to your machine.
You can use the following command to do it.
git clone email@example.com:sudar/wp-irc.git
Replace it with your actual username and project name
Create a new branch
The next step is to create a new branch. You can use the following command to do that.
git checkout -b branch_name
Commit your changes
After you have made the changes, you have to commit them to the new branch
git add file_name
git add -p file_name
git commit -m "Your commit message"
Remember to have a meaning full commit message. If possible follow this guide by Tim Pope on how to construct a good commit message.
Push the change to Github
Next you have to push the changes to Github. You can do it by using the following command.
git push -u origin branch_name
Send a pull request
Now go to Github and send a pull request, by clicking the pull request button in Github. The owner of the repo will be notified and he may choose to accept or reject the request.
Keeping your repo upto date
Once the pull request is accepted, you can merge the changes back to your repo by using the following commands.
git remote add upstream git://github.com/sudar/wp-irc.git
git checkout master
git pull --rebase upstream master
git push origin master