What is a pull request? Explained with an editor's sign-off
A pull request proposes code changes to a shared project so teammates and automated checks can review them before they join the main version. Like sending your edits to an editor before the master copy changes.
- Author
Umair Mateen- Published
- Reading time
- 5 min
- Category
- Engineering
Anthropic's new Claude Ship agents work on GitHub pull requests, and tools from Google and Databricks in this week's news also put their fixes on branches for review through pull requests, so it helps to know what one is.
In one sentence: A pull request is a proposal to add a set of code changes to a shared project, which teammates and automated checks review, and which is only merged into the main version once it is approved.
The everyday picture
Picture an office that publishes a company handbook. There is one master copy, and it is the version everyone reads. Nobody scribbles on it directly.
When a writer wants to change a chapter, they make their own working copy and edit that. Then they send it to the editor with a note: what changed, and why. The changes are marked, so the editor sees exactly which lines are new.
The editor reads it, leaves comments, and either asks for fixes or signs it off. Only then do the changes go into the master copy. That note to the editor is the pull request.
The writer edits a separate copy and sends a marked-up draft. Checks and the editor review it, and only an approved draft changes the master copy.
How it works, step by step
- The main branch (the master copy) holds the version of the code that is live or ready to release. GitHub calls this the default branch, and new pull requests aim at it unless you choose another.
- A branch (the writer's working copy) is a separate line of work. GitHub's docs describe branches as a contained area where you can build a feature, fix a bug or try an idea without affecting other people's work.
- The pull request (the note to the editor) proposes merging the changes from that branch into the main branch. It shows every changed line and explains the reason. GitLab calls the same thing a merge request.
- Automated checks (the office's spelling and layout checks) run on the proposed changes. GitHub lists tests, builds and code scanning as examples. Their results show on the pull request.
- Review (the editor's read-through) is where teammates, and now sometimes AI agents, comment line by line. A reviewer can approve the change or ask for changes first.
- Merging (updating the master copy) adds the changes to the main branch once the reviews and required checks are done.
Try it · Put it in order
Can you put a pull request's journey in order?
Tap the steps in the order they happen.
Where the picture stops
- A handbook editor works alone. A pull request can have several reviewers at once, plus automated checks, and the team decides how many approvals are needed.
- Two writers rarely edit the same sentence. In software it happens often. When two branches change the same lines in different ways, Git cannot pick a winner. This is a merge conflict, and GitHub keeps the merge button off until someone decides the final text.
- An office relies on habit to protect the master copy. Code platforms can enforce it with branch protection rules, which can require reviews and passing checks before anything merges.
Why it matters for your business
- Fewer mistakes reach customers. Every change gets a second pair of eyes and automated tests before it goes live.
- A clear record. Each pull request keeps the what, the why, the discussion and who approved it, which helps when something breaks later.
- Safer AI coding tools. Many AI agents now deliver their work as pull requests. If your branch rules require a human approval, a person still decides what merges. If they don't, an agent's change could merge with nobody looking, which the Claude Ship docs warn about when auto-merge is on.
- Control that doesn't rely on trust alone. GitHub's branch protection can require a set number of approvals, passing checks and resolved comments, and can block force pushes and deletion of the branch.
Try it · What would you do?
How should you let an AI agent work on your code?
Your team wants an AI coding agent to fix small bugs in your online shop's code. It can open pull requests on your repository.
Pick what you would do. You can change your mind.
An example
Imagine a 15-person online shop with two developers. One adds a new discount code feature on a branch and opens a pull request. The tests run and one fails: the discount can make a price go below zero. The developer fixes it and pushes again. The second developer reviews, asks for a clearer error message, then approves. Only then does the change merge and go live. The shop owner never sees the broken version.
Frequently asked questions
Is a pull request the same as a merge request?
Yes, in practice. GitHub calls it a pull request and GitLab calls it a merge request. Both are a proposal to merge one branch into another, with review before it happens.
Why is it called a "pull" request?
You are asking the project's owners to pull your changes into their main version. The name stuck even though, on most platforms, the change is merged with a button.
Do I need pull requests if I'm the only developer?
They are still useful. Automated checks run before anything goes live, and you keep a written record of every change. With AI coding agents on a project, they also give you a clear point to review the agent's work.
Can an AI agent approve its own pull request?
That depends on your settings, not the agent. Branch protection rules decide what has to happen before a merge, so you can require a human approval on your main branch.
Related explainers
The DevDrift sets up development workflows where AI agents propose changes and people approve them: see how.
Sources
Could you explain this to a colleague now?
Mark it and posts that mention it will show a tick. Saved in this browser only.