Tech, ExplainedCloud platforms and developer tools
Concept

Pull request

A change others check before it lands.

HOW IT WORKSA developer makesa change on abranch, a privatecopy of the codeThe developeropens a pullrequest that showsevery changed lineThe pipeline buildsthe change and runsthe testsReviewers comment, andapprove the change orask for fixesThe approvedchange is mergedinto the main codeNo change reaches the main code until someone other than its author has checked it.HOW IT WORKSA developermakes achange on abranch, aprivate copyof the codeThe developeropens a pullrequest thatshows everychanged lineThe pipelinebuildsthe changeand runsthe testsReviewerscomment, andapprove thechange or askfor fixesThe approvedchange ismerged intothe main codeNo change reaches the main code until someone other than its author has checked it.HOW IT WORKSA developer makes a change on a branch, aprivate copy of the code↓The developer opens a pull request thatshows every changed line↓The pipeline builds the change and runsthe tests↓Reviewers comment, and approve the changeor ask for fixes↓The approved change is merged into themain codeNo change reaches the main code until someone other thanits author has checked it.
A developer's change on a branch becomes a pull request, the pipeline tests it, reviewers comment and approve it, and only then is it merged into the main code.
opens a page inside this one a page in the same scene a page in another scene a concept page a label only, with no page

A pull request is a proposed change to a program's code that other developers read, test and approve before it joins the main code. GitLab and some other tools call it a merge request. The name comes from the request itself: the developer asks the team to "pull" the change into the main code. A pull request is the moment when one person's work is checked by others before it can reach customers.

Here is how it works in general. A team keeps its code in a code repository, a store that keeps every file with its full history. The version that the team trusts is called the main branch. A developer who wants to change something first makes a branch, a private copy of the code, and makes the change there. When the change is ready, the developer opens a pull request. It shows the exact lines added and removed, a short description of why, and usually a link to the ticket in the issue tracker that asked for the work. The CI/CD pipeline then builds the change and runs the automated tests on it. One or two reviewers read the changed lines, write comments on particular lines and ask questions. The developer answers and pushes fixes to the same pull request. When the tests pass and the reviewers approve, the change is merged, which means it is added to the main branch. From there, the pipeline can send it on to production, the live system that customers use.

Most teams set rules for this. For example, no one may change the main branch directly, every pull request needs at least one approval, and all tests must pass first. Small pull requests, of a few dozen lines, are reviewed faster and more carefully than large ones.

Take, for example, a bank's mobile-app team. Its rule may say that any change to the code that moves money needs two approvals, one of them from a senior engineer.

Consider an open-source library that thousands of companies use. A student in Bhubaneswar finds a bug and opens a pull request with a fix, and a maintainer of the library reviews it before accepting it.

Say a developer hands a task to an AI coding agent. The agent writes the change and opens a pull request, and an AI code review tool comments on it before a person approves it.

How is a pull request different from a commit? A commit is one saved step in the history of the code, with a short message. A developer may make ten commits on a branch while working. A pull request collects those commits into one proposal and adds the discussion, the test results and the approvals. A commit records a change; a pull request decides whether the change is accepted.

Appears in

Cloud platforms and developer tools
  • Code repository↗ DevOpsA code repository stores each pull request beside the main code, shows its changed lines, and merges it into the main branch only after the required reviewers approve it.
  • Test orchestration↗ Software testingTest orchestration decides which tests to run for each new pull request and spreads them across many devices at once, so the developer sees the results in minutes.
  • AI code review↗ AI codingAn AI code review tool reads each pull request as soon as it is opened, comments on bugs and missed cases, and summarises the change for the human reviewer.
  • AI coding agent↗ AI codingAn AI coding agent ends its task by opening a pull request with the change and the tests it wrote, so that a person can review the work before it is merged.
Tech, Explained is a part of ingrid.fyi. Every page explains one piece of technology in plain words.