7-step beginner’s guide to open-source contribution on GitHub
Contributing to open-source projects not only adds value to the project but also drives the entire community forward. Besides we all want to build a nice GitHub profile and earn those shiny contribution badges to showcase on profile.
Let’s take an example that I want to contribute to the following Repository: https://github.com/clvrai/awesome-rl-envs
Step 1 — Fork the target repository to contribute
This will fork the target repository to your own GitHub. From here on I will call this repo as “your forked repo”.
Target Repo: https://github.com/clvrai/awesome-rl-envs Forked Repo: https://github.com/nitesh4146/awesome-rl-envs
Step 2 — Clone the forked repository
Example: git clone [https://github.com/nitesh4146/awesome-rl-envs.git
](https://github.com/nitesh4146/awesome-rl-envs.git)
Note: Remember this is the forked repository and not the target repository
Step 3 — Adding upstream remote
-
Change the directory to the forked repository:
cd awesome-rl-envs
-
Add the target repository as upstream remote:
git remote add upstream [https://github.com/clvrai/awesome-rl-envs.git
](https://github.com/clvrai/awesome-rl-envs.git) -
Use
git remote -v
to verify the changes. It should look like this:
origin [https://github.com/nitesh4146/awesome-rl-envs.git](https://github.com/nitesh4146/awesome-rl-envs.git) (fetch)
origin [https://github.com/nitesh4146/awesome-rl-envs.git](https://github.com/nitesh4146/awesome-rl-envs.git) (push)
upstream [https://github.com/clvrai/awesome-rl-envs.git](https://github.com/clvrai/awesome-rl-envs.git) (fetch)
upstream [https://github.com/clvrai/awesome-rl-envs.git](https://github.com/clvrai/awesome-rl-envs.git) (push)
Step 4 — Keep your cloned repository Up-to-date
Make sure that your cloned repository is updated to latest changes in the target repository. To do this pull the upstream remote using :
git pull upstream master
Step 5 —Make your awesome contributions
Make changed to your local repository files as needed for meaningful contributions
Step 6 —Add, Commit and Push the changes
-
Stage your changes with following command:
git add -A
-
Commit the changes:
git commit -m "DESCRIPTION MESSAGE"
-
Push to branch (master in this case)—
git push origin master
Step 7 — Create Pull Request
Reload your forked repository and you should see an option to create a pull request. Verify your changes and add a brief description of your contribution(s).
Hope you all find this minimal step-wise post helpful. Let me know your first-time contributions in the comments.
Comments