How to create a pull request in GitHub?: A small guide to beginners in Hacktoberfest-2022

With the start of Fest 2022, it is important to learn how to fork and clone a repository so you can make valid changes and later make a pull request. This article is for beginners who are confused as to how we can contribute to the open source.

You know the basic git commands which I have discussed in my article named — . However, contributing to other people’s repositories might be tricky if you’re new to it. So, let’s start with the way to fork the GitHub projects. For that reason, I have made this short guide for you.

First, visit the repository you want to fork and work on. You can see the option fork in the figure below: -

This will create a copy of the above in your profile under your username as: -<username>/<repo_name>

Now, we need to bring the repo to your local device with the help of the following command: -

git clone https://github/<username>/<repo_name>

This would download all the code, branches, and commits from the original repository to your device. Then, we need to do some things that are explained below: -

  • Creating a new branch

git checkout -b branch_name

  • Creating a new remote for the upstream repo with the command (Not always required)

git remote add upstream <original repo_name>

Then, you can make changes in the code and the usual push operations: -

git add .

git commit -m "the changes"

git push -u origin branch_name

After this, you can go to the GitHub repo you forked earlier and then click the “compare and pull request” button you will be redirected to a screen where you can also add comments for the request and you can finally create a successful pull request which the maintainer will see and review to decide if they want to merge the changes.

I hope this article was helpful to you.

Please don’t forget to applaud this article and follow me!!!

Any kind of feedback or comment is welcome!!!

You can also subscribe to my stories via email so that you’ll get notified whenever I bring out an article on a new subject.

Thank you for your time and support!!!!

Keep Reading!! Keep Learning!!!



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store