How To Create a Pull Request in GitHub?

Last Updated : 19 Jun, 2024

Pull requests are an important part of collaborative software development on GitHub. They allow developers to propose changes, review code, and discuss improvements before integrating new code into a project. This guide will walk you through the process of creating a pull request in GitHub, ensuring your contributions are seamlessly integrated into the main project.

What is a Pull Request?

A pull request (PR) is a method for contributing changes to a repository. It allows developers to request that changes made in a branch be merged into another branch, typically the main branch. Pull requests provide a platform for code review, discussion, and collaboration, ensuring that the code meets the project’s standards before being merged.

How To create a pull request in GitHub?

Step 1: To start contributing, fork a repository of your choice to which you want to contribute.

Screenshot-(92)
Fork the repo

Step 2: Check for the issues that the project admin (PA) has put up in his or her repository & choose to work on one of the listed.

issues
Issues of repo

Step 3: Ask the PA to assign one of issues to you & then start to work on them.

Screenshot-(87)
Comment to get assigned

Step 4: Clone the repository in your VS code using the following command once the issue has been assigned:

git clone "https://github.com/YOUR-USERNAME/YOUR-REPOSITORY"

Here's where you will find the GitHub link to clone the repository:

Screenshot-(93)
Link of repo

Step 5: After cloning the repository in your desired location through git or VS Code terminal start to make changes in the repository by creating a new branch using the following command:

git checkout -b "UI"

Step 6: Make changes to files & then add files if made new using the following command:

git add .

Step 7: Add a commit message for your repository using the following command:

git commit -m "Made changes to the UI of search bar"

Step 8: Now go to the repository on GitHub & above will appear a message that this repository had recent pushes. Choose to create a pull request by comparing the changes between both branches, one main branch & the other one 'UI'.

Screenshot-(88)
Compare & Pull request

Step 9: Add details of the PR & also prefer to add a screenshot for the PA to review better. Also state the issue number by using the # keyword to specify better.

Screenshot-(90)
Submit PR from UI branch to main branch

Step 10: At last, submit the PR & wait for the PA to review it and then merge further in the repository.

Screenshot-(91)
Submit the PR
Comment
Article Tags:

Explore