How to Contribute to a Github Repository
Raphael Tang / June 18, 2022
3 min read
A simple guide to contributing on Github
When you play the game of clones, you merge or you reset --hard.
Anyway, if you want to contribute to a project and make it better, your help is always appreciated. Contributing to a project is also a good way to learn more about social coding on Github, new technologies and their ecosystems and how to make constructive, helpful bug reports, feature requests and the noblest of all contributions: a good, clean pull request.
Fork the repository to your personal Github. Forking is basically an easy way to make a duplicate of the repository to your own account. You need to do this so that you don't modify the original repository.
Now that you have forked the repository to your account, go to the repository in your account, then click on the clone button and hit the copy to clipboard icon.
Now, open a terminal on your local machine and clone the forked repository by doing:
git clone <copied url>
git clone <https://github.com/raphtlw/Checkra1nBot.git>
Create a branch in git inside your local machine:
git checkout -b <branch-name>. You can name this anything you want. Just make sure there are no spaces.
Now you can fix bugs or do whatever you need to do in order to improve the code in the project. Follow the code style of the project, including indentation. If the project has tests run them! Write or adapt tests as needed. Add or change the documentation as needed. Remember to make sure the changes are applied only to the branch you created!
If exists, open
Contributors.mdin a text editor and add your name to it. Don’t add it at the beginning or the end of the file, add it anywhere in the middle of it. Now, save the file.
Commit those changes by doing
git commit -m "Added <your-name> to contributors list“-m” tells git that you are committing the changes with a message to tell people what the commit is about.
Push those changes to the forked repository on Github via:
git push origin <your-branch-name>replacing
<your-branch-name>with the name of the branch you created earlier.
If you go to your repository on GitHub, you’ll see a
Compare & pull request button. Click on that button.
Now, submit the pull request.
Congrats! You have successfully contributed to a Github repository. Now you’ll just have to wait for the repository owner/admins to accept your pull request.
Thanks for reading this guide!
Header image by [Yancy Min](https://unsplash.com/@yancymin) on [Unsplash](https://unsplash.com)
Subscribe to the newsletter
Get emails from me about software development, SaaS, and early access to new articles.