Amay Jain
Amay Jain (@BrajBliss)


Amay Jain (@BrajBliss)


How to Open a Pull Request on GitHub?

Learn about Pull Requests and open one yourself. Get started with Open-Source today!

Amay Jain's photo
Amay Jain
·May 14, 2022·

4 min read

How to Open a Pull Request on GitHub?
Play this article

Table of contents

What exactly is a Pull Request?

This article presumes basic familiarity with GitHub, Git, and version-control.

While working on a project, it is vital to keep every member aware of our individual updates, fixes, and changes. This is where pull request or merge request plays an important role.

When we open a pull request, the assigned member can then review the code and changes, if that turns out well and good, the request is then merged with the original codebase.

What are Merge Conflicts?

When more than one member is working on the same file, Git cannot decide whose version is the best one to keep. In order to fix this issue, we make use of something called resolving merge conflicts.

These can be resolved by using Git on our terminal or we can resolve smaller conflicts on GitHub itself.

Steps to open your very first Pull Request on GitHub

1. Fork the desired Repository

GitHubRepoOptions Look for the following set of options on the top right side of any repository. The first option is to pin a repository to the GitHub Profile. The next one is called watch, basically, it gives a personalized notifications for any activity we want from that repository. The star option will put the repository in the starred section to find it later easily.

💡 It is possible now to create lists to sort out all starred repositories!

The one we want to use is the fork. What this option does is copy the repository to keep the original clean and safe from any unwanted or breaking changes. We can then work on it without actually affecting the original one.

2. Clone the Repository

Now that we have forked that repository, it is time to clone it on the local machine. Open the forked version and then the Code section. image.png There are many ways to do the same, but we will look at the simple HTTPS method. Clone the repository by copying the link from the copy icon and paste the following in the Command Line:

git clone {yourLink}

to clone it in its own folder and

git clone {yourLink} .

to copy in the current folder where the terminal is opened.

💡 Repo is just short for Repository.

3. Open the Code Editor and start making changes

This is where we make all edits and additions to the repository .

4. Check the modifications

Before we go ahead and commit all the tasks we performed in the repository, make sure to use the

git status

command. It will show all the changes saved to the files, unstaged files and more on the terminal.

5. Commit the changes and push them to the repository

After making the changes, we have to update the repository on GitHub. The commands needed now are add, commit, and push. The simple illustration below explains what are these three commands exactly. git-add-commit.png

Image Source: Earth Data Science

Use the command

git add .

to take the changes and make them ready for the next step, which is using the

git commit -m 'commitMessage'

Now the changes are saved on the local repository. There are multiple ways to stage (add), here is a more detailed table: gitAddCommands

Source: Git Guides

The next step is to push the changes just committed to the remote repository. To do that, execute the command

git push origin <branchName>

This will take the commit and push it to the remote repository to the branch we want. In this case, we will use

git push origin main

to push the changes to our Main branch.

5. Create a Pull Request

It is finally time to make a pull request and get it merged! Open the forked repository on GitHub and click on the Contribute button. Click compare & pull request and add details about the request. It will then perform checks for merge conflicts.

And that is it. Once we have created the pull request, someone (either a team member or a bot) will be assigned to review all the changes and either merge them or add a comment if something's wrong. Below is a screenshot from my very first pull request. mergedPullRequest.png


Before you ask where to start, here is the repository for beginners to get to know how all this works. Head over to and go through the documentation to know how to open a PR.

And Thankyou for reading my very first HashNode Blog! 🥳

Here is my GitHub profile if you would like to: @vrindavan

Did you find this article valuable?

Support Amay Jain by becoming a sponsor. Any amount is appreciated!

See recent sponsors | Learn more about Hashnode Sponsors
Share this