The goal of this guide is to get you through your first code contribution to an open source project. The Parallel Architectures Library (PAL) will be used as the example.
Step #1: Set up a GitHub account
Free for all open development (private repository accounts cost money).
Step #2: Navigate GitHub
For the most part GitHub is self explanatory, but you can see 3 of the most important buttons you will need below.
Step #3: Fork a repository
To start contributing to an existing repository (like PAL) you must first create your own personal copy. The easiest way is to log into your GitHub account, browse to an existing repository like (PAL), and to click the ‘fork’ button. See Step #2 if you can’t find the button
Step #4: Setup git on your local machine
Before stating to work on the code you your machine, you will need to install and setup git. If you are using Ubuntu, you can install git easily:
$ sudo apt-get install git
$ git config --global user.name "Your Name"
$ git config --global user.email "email@example.com"
Step #5: Clone your fork
Downloads the repository from GitHub to your local machine. There is a copy paste button in GitHub for those of you with ‘fat fingers’ like me. See Step #2 above if you can’t find the button. Substitute address with your fork of the repository.
Reference: How to clone
$ git clone https://github.com/parallella/pal
Step #6: Adding files
If you are adding new files or folders, use the ‘git add’ command. If you are just editing existing files you can skip this step.
Reference: How to add files
$ git add src/math/p_abs.c
Step #7: Commit your changes
Once you have completed some changes, commit them to your local repository (on your machine). Use “commit -s” to sign your contributions for good practice. many projects require signoff.
Reference: How to commit changes
$ git commit -s src/math/p_abs.c
Step #8: Push changes to your own GitHub fork
Before you can contribute your local changes to the mainline repository you must first sync with your
Reference: How to push
$ git push
Step #9: Submit Pull Request
Now you are ready to submit a pull request to the upstream repository that you forked from (PAL in this case). The easiest way to manage this is through the GitHub web page. See Step #2 above if you can’t find the button on GitHub.
Step #10: Communicate
Once you have submitted your pull request, be ready for comments submitted in response to your PR.