Cover image for Contribute to an existing GitHub project β€πŸ‘Œ

Contribute to an existing GitHub project β€πŸ‘Œ

sachithmayantha profile image Sachith Mayantha Fernando Updated on ・2 min read

Basically, GitHub is a Git repository hosting service. Git is a command-line tool, GitHub provides a Web-based graphical interface. It also provides access control and several collaboration features, such as wikis and basic task management tools for every project.

Let's begin contributing to an existing project.


Firstly, I need to download(clone) that remote repository to our local machine. (Use Git bash to run these all commands)
git clone (web URL)
eg: git clone https://github.com/SachithMayantha/recipe-app.git


Then we need to go to your local repository folder. Change into the repository directory.
cd (folder_name)
eg: cd recipe-app

New Branch

So, we need to create a new branch in this existing repository. Because we can't contribute to the master branch directly. (Because Repository owner is not me). Let's create a new branch to store our new changes.
git branch (my-branch)


Then we need to switch to that new branch. Because our all changes store in there.
git checkout (my-branch)

Let's Code❀😍

This is your chance to show your coding skill. Make changes. You can add, delete or edit any code in that project.

Add Changes

Then we want to add our changed files to our remote repository branch.
git add (file_name) - command use to add one specific file
git add . - command use to add all files


So, take a snapshot of the staging area (anything that's been added).
git commit -m "(can write anything)"


Finally, push changes to our branch of GitHub remote repository.
git push --set-upstream origin (my-branch)

I have to say a special thing about --set-upstream flag. When you push to a remote and you use the --set-upstream flag git sets the branch you are pushing to as the remote-tracking branch of the branch you are pushing.

Thank you.! Happy coding.! 😍❀

Posted on by:

sachithmayantha profile

Sachith Mayantha Fernando


B.Sc.(Special) in Information Systems, Undergraduate at the Sabaragamuwa University of Srilanka. Software Engineer Intern at Epic Technology Group


markdown guide