Open Source projects are a fun way for people, with a common goal, to collaborate on a project from anywhere in the world. It’s amazing what you can learn from being part of a global community. This guide provides a really nice overview of how you can begin to contribute to Open Source projects. This can take the form of documentation, organising events (such as conferences), making contributions to the codebase etc. This post focuses specifically on contributing code.
Contributing code on GitHub
GitHub is a fantastic code hosting platform that makes collaboration and version control very simple. A lot of Open Source projects will use GitHub or Bitbucket (Git for professional teams) as a way for you to access the source code, make modifications and commit changes. For example, the ROS core stacks GitHub account can be found here.
If you’re new to GitHub, a good place to start is the Hello World GitHub tutorial. The Understanding the GitHub Flow tutorial explains the process of creating a branch from the master, making edits and committing them, opening a pull request to get feedback from the project maintainers, deploying your changes in the branch for final tests, then merging the branch into the master.
The Forking Projects tutorial explains how to contribute to other people’s projects. Once the repository is cloned to your local machine, it’s easier to just use the command line for updating (pulling) the repository and committing changes to reflect on GitHub. The Git-Tower Git cheat sheet is quite a nice reference.
The subtle difference between forking and cloning is that a fork creates a new repository that is a personal copy of the repository you are forking. This gives you permissions to make contributions by submitting Pull Requests which can be reviewed by the project maintainers. A clone is a copy of the repository (for example from GitHub to your computer) but you need to be a listed contributor to make changes. Hence you first fork then clone a repository to work on making new contributions to it while working on your local machine.
Choosing an Open Source license
When releasing your code for Open Source use, it’s a good idea to include a README file to tell users how to install and use the code, and a license file to tell users what they can and cannot do with the code. This simple guide is useful for choosing the right license.
Contributing documentation for a project
Most Open Source Projects have guidelines for coding style and documentation which need to be followed to ensure that your contributions get accepted (if they are useful, that is).