Open In App

First Open Source Contribution to GitHub – A Step By Step Guide

Improve
Improve
Like Article
Like
Save
Share
Report

Open-Source Contribution involves contributing to the development of open-source software. It helps us understand the codes of different organizations, work on real-world projects, and contribute to these projects. What does “commit” mean in open-source contribution? In open-source contribution, we can say a commit is adding some features or changes to the project, like adding features, resolving bugs, etc. These commits help organizations improve their features and remove bugs, etc.

Step By Step Guide

Step 1:

Fork the desired repository. We have to contribute to the js-hindi repository, so we forked the js-hindi repository first, then entered Create Fork.

 

Step 2:

Then create a folder for the repository you want to contribute to.

 

Step 3:

  • Open the terminal/command prompt(If you are using Windows) and type git clone for cloning the repository (git clone “the link of the repository which is a fork”).
  • cd Repository name
  • Make the changes in other repositories as you want to change.
  • Type these commands in the repository as mentioned below.

 

 

Why are these commands used to commit?

  1. git clone : A git clone is primarily used to point to an existing repository and make a clone or copy of that repository in a new directory at another location.
  2. cd : To change this current working directory.
  3. git remote add upstream : We use git remote add upstream to specify the remote repository from which we want to pull changes or updates (“git remote add upstream “remote repository link from which you want to pull changes”).
  4. git remote : We use ‘git remote’ to manage the remote repositories associated with our local Git repository.
  5. git pull upstream main : We use git pull upstream main to fetch and merge changes from the upstream repository’s main branch into our local repository’s current branch.
  6. git checkout -b : We use ‘git checkout -b’ to create a new branch and switch to it at the same time(git checkout -b “New branch name”).
  7. git branch -a : We use ‘git branch -a’ to list all the branches in our local repository as well as the remote repositories that are currently available.
  8. git add . : We use ‘git add .’ to stage all changes in the current directory and its subdirectories for the next commit.
  9. git commit -m : We use ‘git commit -m’ to create a new commit with a message that describes the changes we’ve made(git commit -m “Write the message for the author about what you had changed in the repository”).
  10. git remote -v : We use ‘git remote -v’ to display a list of all the remote repositories that are currently associated with our local Git repository.
  11. git push -u origin : We use ‘git push -u origin’ to push our local changes to the origin remote repository and set it as the default upstream branch for the current branch(git push -u origin “the new branch name that you created”).

Compare and Pull request

 

Enter the compare & pull request.

Create Pull Request

 

Leave a comment and then enter Create pull request, and your first pull request is generated. Now the author will check the changes you made, and if he finds them correct, he will accept your pull request; if they don’t find them correct, they will suggest that you make the changes in your commit.

Conclusion

The initiative matters the most. The first step is to contribute, which helps you to gain more knowledge in your field. The open-source contribution helps you build connections with people who are contributing to the projects and who have good knowledge in the field where you want to learn.


Last Updated : 14 May, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads