How do I contribute to other's code in GitHub?

Ideally you:

  1. Fork the project
  2. Make one or more well commented and clean commits to the repository. You can make a new branch here if you are modifying more than one part or feature.
  3. Perform a pull request in github's web interface.

if it is a new Feature request, don't start the coding first. Remember to post an issue to discuss the new feature.

If the feature is well discuss and there are some +1 or the project owner approved it, assign the issue to yourself, then do the steps above.

Some projects won't use the pull request system. Check with the author or mailing list on the best way to get your code back into the project.


To add to Yann's answer, once you have forked a project, you can develop in any branch you want (a new one, or one from the original project)

Remember to:

  • add the original project as a remote (different form 'origin', since origin would be your own repo, result of the fork)
  • rebase your branch on top of the branch of the original repo you want to contribute.
    It is important your pulling request result in fast-forward merges.
    See for instance:
    • "Pull new updates from original Github repository into forked Github repository".
    • "Update of forked repository on github"
    • "Git working fork with updates"

To add to Yan and VonC's answers, this is a good resource from github themselves: http://help.github.com/forking/

Also be sure to look on the right sidebar under the "collaborating" heading.