Bookmarks

PR — pull request (PR, MR)

pull request, merge request

A proposal to merge one Git branch into another: the changes are shown in full, discussed, sent for review and automated tests, and then merged. It is a PR on GitHub and an MR on GitLab.

Also: merge request, MR, PR

checked 9 Nov

All terms

A pull request is the standard unit of collaboration in a repository: the author proposes a change, the team discusses it line by line, automated tests run, and only after review does the branch reach the main one. On GitHub a change is proposed with a pull request (PR), on GitLab with a merge request (MR); the idea is the same.

How a pull request is structured

A pull request always involves two branches: the source branch (head, also called compare on GitHub) with the proposed commits, and the target branch (base) they are meant to be merged into, usually main. The pull request page gathers everything reviewers need:

  • description and discussion: why the change is made, and line-by-line review comments and decisions
  • diffs: which files and lines change, before and after
  • the branch’s commits and how it changed over time
  • status of checks: automated tests, builds and linters from the CI pipeline

A change can be opened as a draft: such a pull request cannot be merged until the author marks it “ready for review”, which is handy for showing work early. A developer outside the team without write access works through a fork: they copy the repository to their own account and open a pull request from the fork into the original project.

Review and branch protection

The reviewer leaves comments on individual lines and gives a decision. The main branch is protected by rules: changes can be merged only through a pull request, with the required number of approvals and passing checks.

Review decisionMeaning
Approvethe changes are approved and can be merged
Request changesthere are comments the author must address before merging
Commentcomments and questions without an explicit approval or rejection

Ways to merge changes

Merging is configured at the project level, and it determines what the history of the main branch will look like:

MethodResult
Merge commita merge commit is added, so both the changes and the branch boundaries are visible (git merge --no-ff)
Fast-forwardno merge commit; possible only while main has not moved ahead (git merge --ff-only)
Squashall the branch’s commits are squashed into one new commit; the original commits stay in the branch

GitLab also offers an intermediate option, a merge commit with semi-linear history: a merge commit is created only if a fast-forward is possible, otherwise you are asked to rebase the branch first.

Sources

the term is written from these pages

Verified 9 Nov

Not to be confused with

what it is mixed up with and how it differs

  • code review

    Code review is the process of checking changes, while a pull request is the proposal that the review is attached to: comments, approvals and check status live on its page.

  • CRchange request

    A change request is a formal application for a change to an IT system, made through a process, while a pull request is the working way to carry a code change through a repository.

In depth in the references

where the topic is covered in detail