Begin by selecting an open-source project on GitHub. For example, you can explore the Cal.com GitHub repository.
Navigate to the Issues section, and filter by labels like good first issue
or bug
to find tasks suitable for beginners.
To work on the project, first Fork the repository (create your own copy) by clicking the Fork button at the top-right of the repository page.
After forking, head to your GitHub profile, locate your forked repository, and click the Code button to copy the HTTPS URL.
Clone the repository to your local machine by running the following command in your terminal:
git clone <your-copied-HTTPS-URL>
Avoid making changes directly to the main
or master
branch. Instead, create a new branch where you can work on the issue:
git checkout -b <branch-name>
Work on fixing the issue. Modify the necessary files and test your changes locally to ensure everything works smoothly.
Once you're confident with the changes, it's time to stage, commit, and push them. Follow these steps:
-
Initialize Git (if necessary):
git init
-
Stage all your changes:
git add .
-
Commit your changes with a meaningful message:
git commit -m "Fixes issue #<issue-id>"
-
Push your changes to the branch:
git push origin <branch-name>
Head back to your forked repository on GitHub. Youβll see a Compare & Pull Request button. Click it, describe your changes, and mention the issue number like this: [fixes #issue-id]
.
Submit the PR and wait for the maintainers to review and merge your contribution.
Once your PR is merged, you need to keep your forked repository up-to-date with the original project. To do so:
-
Add the original repository as a remote:
git remote add upstream <original-repo-HTTPS-URL>
-
Fetch the latest changes:
git fetch upstream
-
Checkout your main branch:
git checkout main
-
Merge the updates:
git merge upstream/main
-
Push the updates to your fork:
git push origin main
This guide simplifies the process of contributing to open-source projects, offering a structured approach for beginners. Happy coding! π¨βπ»π©βπ»