Learning as I go: Contributing to open source
My first time contributing to open source.
Today, I learned about open source and how to contribute. I’m not an expert when it comes to git commands or GitHub. However, I'm familiar with the basic commands like git add, git commit and git push. I was ready to go deeper than just pushing my code to GitHub, I wanted to contribute and get involved in other projects that needed assistance, this meant I needed to kick my GitHub skills up a notch. Thankfully, with a simple google search, I was able to find this wonderful repository for first-time contributors. I highly recommend any newcomers to go there to learn about how to contribute to an open source project when you're starting out.
I believe the repository does an excellent job in explaining how to get started but I will still like to share the process I went through and hope to explain it just in case there is still confusion.
Find the repository you would like to contribute to, during my search I came across a website called first-timers-only which is the same people who created the repository for first-time contributors. On the website, they name other websites that have projects you can contribute to that is suitable for beginners.
Once you have found a repository you want to help out first read the CONTRIBUTING, README or CODEOFCONDUCT files if they have one. These are important because they explain to you how you can contribute. Once you have a good idea on what’s required and how you want to help then you would fork their repository,
which basically means it gives you your own copy of it in your Github. In the end, it will look something like this → your-name/repo-you-forked
After forking the repo, on the right side, there is a green button that says “Clone” clicking on that will show a dropdown with the repo URL that you need to clone. Next, open up your terminal and run
git clone <repo-url> this basically means you want to download a copy of the repo (folder) onto your desktop so you can make your changes to it. You would replace the repo URL with the repo URL you forked.
Once you have cloned the copied repo and it is successfully on your desktop then you want to go inside that folder. You can do this in two ways, go into that folder through the terminal like this
cd <repo-name> or you can drag and drop that folder into your code editor. Once inside that folder, you have to do two things which are run
npm install to install any dependencies and create a branch to work in, run this command
git checkout -b <name-of-branch-you-created>. This basically means you will be pushing your changes to the branch you created not the master branch.
If you made it this far awesome! now all you have to do is to make your desired changes to whichever files your contributing to and then once your done editing you need to save those changes. Back in the terminal making sure your inside that folder you're going to want to run
git add . to add the files you edited.
git commit -m “your-commit-message” to commit your changes to get it ready for pushing. Lastly,
git push origin <name-of-branch-you-created> if everything went successful you won't get any errors in the terminal and everything will be pushed to the branch you created. For the final task, you can now go back to your GitHub page and now you should see “compare pull request” green button, it will take you to the pull request page to commit your pull request :) once you committed it, your all set! all you have to do is to wait to see if they will accept and merge your branch to the master.
Congrats! if everything went well, you successfully made your first contribution/pull request!
If this post helped you give it clap :)
Learn. Build. Have Passion. Contribute