Contributing to project hosted in Github

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.
github-fork

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 git@github.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

or

git add -p file_name

Then do

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

Related posts

Tags: , ,

1 Comments so far

Follow up comments through RSS Feed | Post a comment

  • siva says:

    [posts-by-tag tags = "chicken" number="1000" excerpts = "true" thumbnail = "true"]

    i want pagination for this 1000 posts. can you please give me suggestion

3 Trackbacks/Pingbacks so far

Leave a Reply

Your email address will not be published. Required fields are marked *