What is a pull request?

A pull request is a proposal to merge changes from one branch into another, with a place to review, discuss and test them first. How pull requests work on GitHub.

On this page
  1. How a pull request works
  2. What's in a pull request
  3. Why teams use pull requests
  4. Draft pull requests
  5. An example
  6. Good pull request habits
  7. Pull requests in the notch
  8. FAQs

A pull request is a proposal to merge a set of code changes from one branch into another, usually into the main branch of a project. On GitHub, it's also the place where teammates review the changes, discuss them, and see the results of automated tests before anything is merged. GitLab calls the same idea a merge request. Pull requests are how most software teams get changes reviewed and into the product safely.

How a pull request works

  1. A developer makes changes on a branch, separate from the main code.
  2. They push the branch to the shared repository, such as on GitHub.
  3. They open a pull request, describing what changed and why.
  4. Automated checks run, such as tests and linting. See what is CI?
  5. Reviewers read the changes, comment, and approve or ask for changes. See what is code review?
  6. The author updates the branch in response to feedback.
  7. Once approved and checks pass, the pull request is merged into the main branch.

What's in a pull request

PartWhat it holds
Title and descriptionWhat the change does and why
CommitsThe individual changes on the branch
Files changedThe diff: every line added, removed or changed
ConversationComments, review summaries and events
ChecksResults of automated tests and other checks
Reviewers and assigneesWho's asked to review, and who owns it

Why teams use pull requests

  • Quality: a second pair of eyes catches bugs and design problems.
  • Knowledge sharing: reviewers learn about parts of the code they don't usually touch.
  • Safety: automated checks and required approvals keep the main branch working.
  • History: the discussion stays attached to the change, so future readers can see why it was made.

Draft pull requests

A draft pull request is one that isn't ready to merge. It's useful for sharing work in progress or getting early feedback. Once it's ready, the author marks it ready for review. See draft pull requests on GitHub.

An example

Priya fixes a bug where large report exports fail. She creates a branch named after the issue, commits the fix and a test, and opens a pull request: "Fix export failure for reports over 10 MB". CI runs the tests, which pass. Tom reviews, asks for one extra test case, and approves after she adds it. Priya merges, and the issue in the team's tracker moves to Done.

Good pull request habits

  • Keep them small, one focused change each. See how big should a pull request be?
  • Write a clear description, with how to test it.
  • Request one or two reviewers who know the code.
  • Respond to feedback promptly, and keep the conversation on the code.

Pull requests in the notch

OneNotch shows pull requests from your Mac's notch, using the GitHub CLI: the open pull requests waiting for your review and the ones you've opened, each with a summary of its checks and approvals. You can open a pull request's changes on GitHub, see its checks, and approve one you've reviewed, without keeping a browser tab open. See how to see pull requests waiting for your review.

FAQs

Why is it called a pull request?

You're asking the project's maintainers to "pull" your changes into their branch.

Is a pull request the same as a merge request?

Yes, it's the same idea. GitHub calls it a pull request; GitLab calls it a merge request.

Can I approve my own pull request?

No. On GitHub, authors can't approve their own pull requests.

What happens after a pull request is merged?

The changes become part of the target branch, and the branch can usually be deleted.