DEV Community

Cover image for Contributing to Open-Source Projects on GitHub: A Step-by-Step Guide to Successfully Adding to Existing Code
Oluwatobi
Oluwatobi

Posted on

Contributing to Open-Source Projects on GitHub: A Step-by-Step Guide to Successfully Adding to Existing Code

Are you interested in contributing to open-source projects on GitHub but unsure where to start? This guide will walk you through successfully adding to existing code on GitHub using Git. Learn how to navigate the GitHub interface, fork and clone repositories, change existing code, and submit pull requests. Whether you're a seasoned developer or a beginner, this guide will give you the skills and confidence to contribute to open-source projects and collaborate with other developers on GitHub.

Tips:

  • Fork the repository to create a personal copy
  • Clone the forked repository using SSH (or HTTPS/GITCLI)
  • Ensure to configure SSH on your GitHub

Step 1:
Copy ssh URL
image

Step 2:
Clone (download) on your local repository (gitbash)
using
git clone "paste the ssh URL copied from github"

Image description

Step 3:
Ensure it's downloaded by running a command

ls

Image description

Step 4:
The cd into the directory

Image description

Step 5: Create a branch
git checkout -b feature/update-events

Image description

Step 6:
ls to see the list of files and what you're editing

Image description

Step 7:
Edit the file using Vim

Image description

Step 8:
Insert your edit by pressing I, after save and exit using escape, then :wq! and enter

Image description

Step 9:
Check the status of your edit by using
git status

Image description

Step 10:
Add the file by using
git add "name of the file"

Image description

Then, confirm it added but using git status again

Step 11: Commit changes and also add a message
git commit -m "whatever changes you made"

Image description

Step 12: Push your update
git push

Image description

you might have an error, but don't panic just copy the name suggested and run the command again.

You've successfully made a pull request

Step 13:
Go back to your GitHub to compare & pull request

Image description

Remember, contributing to open-source projects is a great way to collaborate with other developers, learn new skills, and build your portfolio. Don't be afraid to explore and contribute to different projects on GitHub.

Top comments (0)