If you’re new to open source, contributing to projects on GitHub can seem intimidating, but it’s actually a simple process! This step by step guide will help you make your first contribution.
1. Fork the Repository
Start by forking the repository you’d like to contribute to. Forking creates a copy of the repository under your GitHub account, so you can make changes independently. The address for your forked repo will look like this:
https://github.com/<YourUserName>/projectname
Next, clone your forked repo to create a local copy on your computer. Use this command to clone:
git clone https://github.com/<YourUserName>/<projectname>
2. Make Your Changes
Once you’ve cloned the repository locally, you can make any changes you want. It’s best to create a separate branch for your changes, keeping them organized and isolated from the main branch.
First, navigate to the project folder on your computer:
cd project_folder_name
Then create a new branch for your changes:
git checkout -b name-your-new-branch
You’re now working within your new branch. Check the status of your changes anytime with:
git status
This will show you any modified or new files. When you’re ready to add the changes, use:
git add *
Now commit the changes with a short message describing what you did:
git commit -m "Your message here"
3. Submit Your Changes
Once your work is complete, it’s time to push your branch to GitHub and submit your changes. Push your branch with:
git push origin <add-your-branch-name>
After pushing, go back to the repository on GitHub. You should see a Compare and pull request option—click on it to start a pull request. This request is essentially you asking the maintainers to review and merge your changes into the main project.
If all goes well, your changes will be merged, and you’ll receive a notification. Congratulations, you’ve made your first open-source contribution!