Trending
| 8:18 AM IST
Pull Requests on GitHub Explained: Propose, Review and Merge Changes (Part 14)
Tech

Pull Requests on GitHub Explained: Propose, Review and Merge Changes (Part 14)

A pull request is how you propose changes on GitHub and get them reviewed before they reach main. Open, review and merge your first pull request, step by step. Part 14 of our visual Git series.

By · Updated · 9 min read 1 view Rate it 0 comments

A pull request (PR) is a request on GitHub to merge the changes from one branch into another, usually into main. It shows exactly what changed, lets others comment and approve, runs automatic checks and keeps a record of the discussion. Once everyone is happy, you click "Merge pull request" and the work joins main.

Before merging the cake booking feature into the live bakery site, Sneha wanted a second pair of eyes. "Can you check my code before customers see it?" she asked Arjun. He did not ask her to email files. "Push your branch and open a pull request. I will review it on GitHub tonight." The next morning there were three friendly comments waiting, one of which caught a bug that would have rejected every order placed after 6 pm. In Part 13 you merged branches on your own laptop. In teams, merging usually happens on GitHub instead, through a pull request. Even solo builders use pull requests to review their own changes and trigger automatic checks. This Part 14 walks you through the whole cycle.

Your one-minute summary

  • A pull request asks to merge a branch into main
  • Push a branch, then click Compare & pull request on GitHub
  • Write a clear title and description; link issues with Closes #12
  • Reviewers can comment, approve or request changes
  • Push more commits to the same branch to update the PR
  • Merge, then delete the branch

Why is it called a "pull request"?

You are asking the project owner to "pull" your changes into their branch. On GitLab the same feature is called a "merge request", which describes it just as well. GitHub's documentation on pull requests covers every option in detail.

The life of a pull request

Push a branchgit push -u origin feature/cake-booking
Open the PRTitle, description, screenshots
ReviewTeammates comment, suggest, approve
UpdatePush fixes to the same branch; the PR updates
Merge and clean upMerge into main, delete the branch

How do I open a pull request?

Opening your first pull request

1. Push your branchFrom Part 12: git push -u origin feature/cake-booking
2. Open the repository on GitHubA yellow banner says your branch had recent pushes
3. Click "Compare & pull request"Or go to the Pull requests tab and click "New pull request"
4. Check base and comparebase: main ← compare: feature/cake-booking
5. Write a title and description, then "Create pull request"Add reviewers on the right if you work in a team

GitHub Desktop and VS Code (with the GitHub Pull Requests extension) can also create pull requests without opening the browser.

Also readGitHub Actions for Beginners: Let GitHub Test and Deploy Your Website Automatically (Part 19)

What does a good pull request description look like?

A reviewer should understand your PR in one minute. A simple template works for most web projects:

SectionSneha's example
TitleAdd online booking for custom cakes
What changedNew booking page with date picker, cake size and message fields; orders emailed to the bakery
WhyUncle gets many booking calls during festivals. Closes #12
How to testOpen /booking, place a test order, check the email arrives
ScreenshotsDesktop and mobile views
Magic wordsWriting Closes #12 or Fixes #12 in the description links the PR to issue number 12. When the PR is merged into the default branch, GitHub closes the issue automatically. We cover issues in Part 17.

What are the tabs inside a pull request?

Inside a pull request page

Conversation

  • Description and all comments
  • Review status and checks
  • The big green Merge button

Commits

  • Every commit on the branch
  • Messages and authors

Files changed

  • Red and green diff for every file
  • Click a line number to comment on it
  • Start a review here

How does code review work?

In the Files changed tab, a reviewer hovers over a line, clicks the blue + and writes a comment. They can even propose an exact change with the "suggestion" button, which the author can accept in one click. When finished, the reviewer clicks Review changes and picks one of three outcomes:

Three review outcomes

CommentGeneral feedback, no decision
ApproveReady to merge
Request changesFixes needed before merging

To respond, the author simply makes more commits on the same branch and pushes. The pull request updates automatically; there is no need to open a new one. Sneha fixed the 6 pm bug with one commit, and Arjun's next review was an approval.

Kind, useful review comments

Less helpful

  • "This is wrong."
  • "Why did you do this?"
  • "Bad naming."

More helpful

  • "Orders after 6 pm fail here because of the time check; could we use 24-hour time?"
  • "Could you explain this choice? I may be missing context."
  • "Maybe rename btn2 to submitButton so it is clearer?"

Review the code, not the person. Ask questions, suggest fixes and say what you liked.

How do I merge a pull request?

When the PR is approved and any automatic checks pass, the green button on the Conversation tab merges it. GitHub offers three merge methods:

OptionWhat happensGood for
Create a merge commitAll commits kept, plus a merge commitKeeping full detail
Squash and mergeAll commits combined into one on mainClean history with many small commits
Rebase and mergeCommits replayed onto main, no merge commitStraight-line history

Beginners can use either of the first two. After merging, click Delete branch, then on your laptop run git switch main and git pull to get the merged result.

What are draft pull requests?

Open a draft pull request when work is in progress and you want early feedback without anyone merging it. Click the arrow next to "Create pull request" and choose "Create draft pull request". When ready, click "Ready for review".

Should I use pull requests if I work alone?

Yes, for anything more than a tiny change. A PR gives you a final look at the full diff before it reaches main, a written record of why a change was made and, in Part 19, a place where GitHub Actions runs automatic checks. Freelancers can also share a PR link with a client as a clear summary of "what I changed this week".

Before Part 15, make sure you can

  • Open a pull request from a pushed branch
  • Write a description with what, why, how to test and screenshots
  • Leave a line comment in the Files changed tab
  • Explain approve vs request changes
  • Merge a PR, delete the branch and pull main locally

Her View

Code review can feel personal at first, as if someone is grading you. Good teams make it the opposite: a shared effort to make the work better. When you review, be the reviewer you would want, specific, kind and curious. When you are reviewed, remember the comments are about the code, and every one is a free lesson. Sneha now looks forward to Arjun's reviews.

Also readHost Your Website Free with GitHub Pages: Step-by-Step Guide (Part 18)

His Insight

Keep pull requests small: one feature or fix, ideally a few hundred lines at most. Small PRs get reviewed faster and more carefully. Always include "how to test" and screenshots for visual changes. And never merge your own PR into a shared project without review unless the team has agreed that is acceptable.

H View Verdict

Pull requests turn merging into a visible, reviewable step, which makes quality and collaboration easier. They are the heart of how work happens on GitHub. In Part 15, we use them to contribute to other people's projects through forks, the first step into open source.

Self-assessment: test yourself

Ready? Tap an option for each question. You will see right away whether you got it, with a short explanation, and your score at the end. Take your time, and try again as often as you like.

Pull request quiz: 10 questions

1. What does a pull request ask for?

  1. A new GitHub account
  2. To merge one branch's changes into another
  3. To delete main
  4. To download a repository

A PR proposes merging a branch, usually into main.

2. How do you update an open pull request after feedback?

  1. Open a new PR
  2. Push new commits to the same branch
  3. Delete the PR
  4. Email the reviewer

The PR tracks the branch, so new commits appear automatically.

3. Writing "Closes #12" in a PR description

  1. Deletes 12 files
  2. Closes issue 12 when the PR is merged
  3. Locks the repository
  4. Requests 12 reviewers

GitHub links the PR to the issue and closes it on merge.

4. Which merge option combines all commits into one?

  1. Create a merge commit
  2. Squash and merge
  3. Rebase and merge
  4. Draft merge

Squash combines the branch's commits into a single commit on main.

5. Which tab shows line-by-line changes for review?

  1. Conversation
  2. Commits
  3. Files changed
  4. Insights

Files changed shows the diff and lets reviewers comment on lines.

6. What is a draft pull request for?

  1. Deleting a branch
  2. Sharing work in progress without it being merged
  3. Hiding code
  4. Paying for reviews

Drafts invite early feedback and cannot be merged until marked ready.

7. Which review outcome means fixes are needed?

  1. Approve
  2. Comment
  3. Request changes
  4. Merge

Request changes signals the PR is not ready yet.

8. What is GitLab's name for a pull request?

  1. Push request
  2. Merge request
  3. Branch request
  4. Fork request

GitLab calls it a merge request; the idea is the same.

9. Which comment is the most helpful?

  1. "This is wrong."
  2. "Bad code."
  3. "Orders after 6 pm fail here; could we use 24-hour time?"
  4. "Why?"

It explains the problem and suggests a fix.

10. After merging a PR on GitHub, what should you do on your laptop?

  1. Nothing ever
  2. git switch main and git pull
  3. git init again
  4. Delete the .git folder

Pulling brings the merged result to your local main.

Frequently asked questions

Is a pull request the same as a merge request?

Yes. GitHub and Bitbucket say pull request; GitLab says merge request. The idea is the same.

Can I open a pull request without the terminal?

Yes. GitHub Desktop has "Create Pull Request" in the Branch menu, and you can edit files and open PRs entirely on GitHub.com.

What if my pull request has conflicts?

GitHub shows "This branch has conflicts". Resolve them with the "Resolve conflicts" button for simple cases, or locally by merging main into your branch as in Part 13, then push.

How many reviewers should a pull request have?

For small teams, one reviewer is common. Repository settings can require a minimum number of approvals before merging.

Part 14 of 20 in our Git and GitHub for Beginners series. A small tip from us: ask a friend to review your next pull request, and offer to review theirs. You will both learn twice as fast. Next up, Part 15: Forks and contributing to open source.
Topics: Tech
Harika Behara

Writes for H View, where every story follows our editorial policy and is reviewed before it is published.

All stories by Harika →

H View stories follow our editorial policy. Spotted an error? Tell us and we will correct it.

Rate this article

One tap is enough. No comment needed.

Your rating
Be the first to rate it.

Was this article helpful?

Your answer goes straight to our editors.

Comments0

Be kind and stay on topic. Comments with links are checked before they appear.

No comments yet. Start the conversation.

The H View Brief

Our best stories, in your inbox.

The week’s best Her View, His Insight reading in one short, useful note.

Free. We only use your email to send The H View Brief. Unsubscribe any time.