A pull request is a proposed code change that people and automatic checks review before it joins the main project.
This guide is for anyone who has heard developers talk about "PRs", "approvals" or "checks" and wants to know how they keep code safe. You do not need to write code: if your business builds or changes software, these checks are part of how it stays trustworthy.
In short
- A pull request lets a team look at a change before it is added to the main code.
- Rules on the main branch can require approvals and passing checks before anything is merged.
- A good review asks security questions too, such as "does this add a secret or new access?"
- Admins may be able to skip the rules unless the team turns that off.
What you will learn
- Explain what a pull request is and why it is reviewed.
- Spot the rules that stop unchecked code being merged.
- Ask the security questions that belong in a review.
- Check whether anyone can skip the rules.
- Proposed change (pull request)
- a request to add a set of code changes, shown so others can review them first.
- Lock on the main code (branch protection)
- rules that decide what must happen before changes join the main line of code.
- Automatic test (status check)
- a tool that runs on each change and reports pass or fail.
What is a security review of a pull request?
Think of a newspaper. A reporter writes a story, but it does not go straight to print. An editor reads it, and a fact checker checks it first.
Code works in a similar way. A developer makes changes on their own copy, called a branch. Then they open a pull request to ask for the changes to be added, or merged, into the main code. Other people read the change, and tools test it, before it is merged [1].
A security review is the part where reviewers also ask: could this change make the software less safe? It looks at the design of the change, not only whether it works.
Where the comparison stops working: an editor reads every word. A reviewer may see hundreds of changed lines and miss one. That is why teams add automatic checks and clear rules, not only human eyes.
Why does it matter?
Once a change is merged, it can reach customers quickly. A review is often the last point where a person looks before that happens.
If you are a junior developer
What could happen: a test password left in your change is merged and copied into many places.
Check this: read your own pull request before you ask anyone else to.
If you manage a software team
What could happen: one person merges a risky change alone, late on a Friday.
Check this: ask whether the main branch requires at least one approval and passing checks.
If your team uses bots or AI coding tools
What could happen: a tool with its own access opens changes that nobody reads closely.
Check this: make sure a named person approves every change made by a tool.
What does it look like?
Here is a made-up summary of a pull request, as a team might see it before merging.
Example only. All values are made up.
Pull request #0000: Add export to example.invalid Branch: feature/export into main Files changed: 6 Approvals: 1 of 2 required (1) Code owner review: waiting (payments team) (2) Check "tests": passed Check "secret scan": failed (3) New setting: EXPORT_TOKEN=FAKE-TOKEN-0000 (4) Merge: blocked (5)
- The team requires two approvals, and only one has been given.
- The change touches payment code, so that team must approve it.
- A scanning tool has spotted something that looks like a secret.
- In a real file, this line would contain a token that lets the app reach another service.
- The rules stop the merge until every requirement is met.
Why this is risky: a secret has been written into the code. Anyone who can read the project can copy it.
The safer way: the code names the setting only, and the app fetches the value from a vault. The reviewer asks who owns the new token and what it can reach.
How does it work?
- A developer opens a pull request. It shows the changes and lets people discuss them before merging [1].
- Owners are asked to review. A file can list who is responsible for each part of the code. Those people are asked to review changes to their part automatically [3].
- Checks run. Tests and scanners run on the change. The main branch can require every chosen check to pass before merging [2].
- Reviewers approve or ask for changes. The branch can require a set number of approvals [2]. If new changes arrive later, old approvals can be cleared, so someone looks again [2].
- The change is merged. Only when the rules are met does the merge button work.

Different code hosting services use different words for the same idea. GitHub calls these rules branch protection rules [2]. GitLab has protected branches that control who can merge and push [4], and its required approvals mean merging is not possible without them [5]. Services are listed alphabetically.
One setting deserves a close look. On GitHub, branch protection rules do not apply to repository admins by default. A team can turn on an option so the rules apply to admins too [2].
The security part of the review is a set of questions. We suggest reviewers ask:
- Does this change add a password, key or token?
- Does it give a person or a program more access than before?
- Does it send data to a new outside service?
- Does it change who can sign in, or how?
- Does it change the checks or the build steps themselves?

A worked example
Umar Mbeki leads a small team that builds an online booking app for dental surgeries. Imani Quist joined three months ago as a developer.
Imani adds a feature that sends booking reminders by text message. To test it quickly, she puts the text service's token straight into the code. She opens a pull request and asks Umar to review it.
Before Umar even opens it, the secret scan check fails. The merge button is greyed out. The team set up the main branch so that every check must pass and one approval is required.
Umar reads the change and asks the five security questions. Two answers are yes. The change adds a token, and it sends patient phone numbers to a new outside service.
He asks Imani to move the token into the company's vault. He also asks her to replace it, since the old one is in the branch history. He also asks the person who looks after data protection to confirm the text service is approved.
While checking the settings, Umar spots that admins can still skip the rules. He is an admin himself. He turns on the option that applies the rules to admins too.
Imani pushes the fix. The old approval is cleared because the code changed, so Umar reviews again. The checks pass, and the change is merged on Thursday.
Myths and mistakes
| What people think | What is true |
|---|---|
| If the tests pass, the change is safe. | Tests check that code works. Security questions check what it adds, such as new secrets or new access. |
| Admins always follow the branch rules. | On GitHub, admins are not bound by default. A team can turn on an option so they are [2]. |
| An approval still counts after more code is added. | It can, unless the team turns on the option that clears old approvals when new changes arrive [2]. |
| Changes from bots do not need a person to review them. | Bots and AI tools act with their own access. A named person should still approve their work. |
What can I do this week?
- Ask whether your main branch requires at least one approval before merging.
- Check which automatic checks must pass, and whether a secret scan is one of them.
- Find out whether admins can skip the rules.
- Add the five security questions to your pull request template.
- List any bots or AI tools that can open pull requests, and who approves their work.
Checklist
- The main branch is protected.
- At least one approval is required before merging.
- Required checks include tests and a secret scan.
- Code owners are set for sensitive parts of the code.
- Old approvals are cleared when new changes arrive.
- The rules apply to admins too.
- Reviewers ask the security questions on every change.
- A named person approves changes opened by bots or AI tools.
Common questions
Is a pull request the same as a merge request?
Yes, for most purposes. Both are a proposed change that others review before it joins the main code. GitHub uses the name pull request [1]. GitLab uses merge request [5]. The ideas of approvals, checks and protected branches are much the same on both services.
How is this different from secure code review?
It is the same habit, placed at a fixed gate. Secure code review is reading code for security problems. This guide covers where that happens in a pull request, and the branch rules that make sure the review and checks happen before any merge.
Do small teams need branch protection?
Yes, a light version helps. Even a team of two can require one approval and one passing check. It costs a few minutes per change. In return, nobody can merge an unchecked change by mistake, including the most senior person.
What is a code owner?
A code owner is a person or team responsible for part of the code. They are listed in a special file. When someone changes their part, they are asked to review it automatically, and the branch can require their approval before merging.
Who should review changes made by AI coding tools?
A person who understands the code, and who did not ask the tool to make the change. AI tools are non-human identities with their own access. Treat their pull requests like any other change, with the same rules and at least one human approval.
Where next?
Ready for the detail? Read the practitioner guide: AI Coding Agent Pull Request Governance Guide. It goes further into identities for coding agents, who may approve agent work, and how to stop fake passing checks.
Also useful:
- Secure Code Review for Beginners
- Source Code and Version Control for Beginners
- Code Scanning Tools for Beginners
- GitHub Security for Beginners
Related NHI Mgmt Group resources: Secure Code Review Guide, CI/CD Pipeline Security for Beginners and Secrets in Code for Beginners.
Key terms
- Pull Request Security Review
- Checking a proposed code change for security problems before it is merged.
- Branch Protection
- Rules that control what must happen before changes join an important branch.
- Status Checks
- Automatic tests that report pass or fail on each proposed change.
- CODEOWNERS
- A file that lists who is responsible for each part of the code.
- Pull Request Approval
- A reviewer's sign-off that a change may be merged.
- Code Review
- Another person reading code to find mistakes before it is used.
Sources and further reading
- GitHub, "About pull requests", GitHub Docs. https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests (accessed 2 Dec 2026).
- GitHub, "About protected branches", GitHub Docs. https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/about-protected-branches (accessed 2 Dec 2026).
- GitHub, "About code owners", GitHub Docs. https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners (accessed 2 Dec 2026).
- GitLab, "Protected branches", GitLab Docs. https://docs.gitlab.com/user/project/repository/branches/protected/ (accessed 2 Dec 2026).
- GitLab, "Merge request approvals", GitLab Docs. https://docs.gitlab.com/user/project/merge_requests/approvals/ (accessed 2 Dec 2026).