Lessons · GitHub and GitLab · 02

Pull request vs merge request

A pull request and a merge request are the same thing: a request to review a branch and merge it into another branch. GitHub calls it a pull request (PR). GitLab calls it a merge request (MR).

One clipped request sheet with a single round stamp: the same ask, whichever name the host gives it.

You learned one word, then joined a team that uses the other. Nothing is wrong. A pull request and a merge request are one idea with two names. You push a branch. You ask for it to be reviewed and merged. People comment. Checks run. Someone merges.

The details around that idea do differ a little between GitHub and GitLab. This lesson is those details, checked against each host’s own documentation. If commit and branch are still new words, read commit vs pull request first.

Pull request vs merge request, side by side

GitHub pull requestGitLab merge request
Short namePRMR
Reference#12!12
Branch with your commitsCompare branch, also called the head branchSource branch
Branch you merge intoBase branchTarget branch
Command linegh pr createglab mr create, or a push option
Not ready yetDraft pull requestDraft merge request, title starts with Draft:
Review outcomesComment, Approve, Request changesComment, Approve, Request changes
Required approvalA branch protection rule set by a repository adminApproval rules. Optional on the Free tier, enforceable on Premium and Ultimate
Ways to mergeMerge commit, squash and merge, rebase and mergeMerge commit, merge commit with semi-linear history, fast-forward merge, each with optional squash
Merge when checks passEnable auto-mergeSet to auto-merge
Automated checksThe Checks tabCI/CD pipelines

Why there are two names

Both names describe the same request from different ends.

Pull request comes from asking a maintainer to pull your branch into theirs. Git itself has a command for the idea, git request-pull, which prints a summary that asks an upstream project to pull your changes. GitHub turned that ask into a web page.

Merge request names the last step instead. You are asking for a merge. GitLab chose that word.

Neither is a Git feature. Git has commits, branches and merges. The request page belongs to the host, so the name changes when the host does.

The workflow is the same

Here is one small change on each host. The first four lines are plain Git and do not change. Only the last line knows which host you are on.

On GitHub, with the GitHub CLI:

git switch -c rate-limit
git add -A
git commit -m "Return 429 when over the limit"
git push -u origin rate-limit
gh pr create --base main --title "Add a 429 path" --draft

On GitLab, with the GitLab CLI:

git switch -c rate-limit
git add -A
git commit -m "Return 429 when over the limit"
git push -u origin rate-limit
glab mr create --target-branch main --title "Add a 429 path" --draft

GitLab can also open the merge request from the push itself, with push options:

git push -u origin rate-limit \
  -o merge_request.create \
  -o merge_request.target=main \
  -o merge_request.draft

After that the loop is identical. Reviewers read the diff and comment on lines. You push more commits to the same branch and the request updates. When it is approved and the checks are green, someone merges.

Draft pull requests and draft merge requests

Both hosts let you open the request before it is ready. A draft says “look if you want, do not merge.” Neither host will merge a draft.

GitHub. Open the dropdown on the create button and choose Create draft pull request. When it is ready, click Ready for review in the merge box. You can go back with Convert to draft in the sidebar. Code owners are not asked to review until the draft is marked ready.

GitLab. Select Mark as draft, or start the title with Draft:, [Draft] or (Draft), or write /draft in a comment. Select Mark as ready, or write /ready, when it is done. A draft still runs the same pipelines as a ready merge request.

Older GitLab versions called this WIP, for work in progress, with a WIP: title prefix. GitLab renamed it to Draft in version 13.2 and later removed the WIP prefix. If a teammate says “WIP MR,” they mean a draft.

Approvals

Review looks alike on both. A reviewer finishes with one of three outcomes: Comment, Approve, or Request changes.

What differs is how approval becomes a rule.

GitHub. Anyone with read access can review. To make approval mandatory, a repository admin adds a branch protection rule that requires an approving review before merge. A CODEOWNERS file can request review from the owners of the changed files automatically.

GitLab. Approvals exist on every tier. On the Free tier they are optional and do not prevent a merge. On Premium and Ultimate, approval rules can require approval from named people before a merge is possible. A reviewer who selects Request changes blocks the merge until they approve, or until someone with merge permission bypasses it.

Merge options

This is where the two hosts differ the most, and it is a setting, not a habit you carry in your head.

GitHub offers three buttons on the pull request, if the repository allows them:

  • Merge commit. The default. Every commit from the branch lands on the base branch, plus one merge commit.
  • Squash and merge. The commits are combined into a single commit on the base branch.
  • Rebase and merge. Each commit is added to the base branch on its own, with no merge commit.

GitLab sets one merge method for the whole project:

  • Merge commit. Every merge creates a merge commit.
  • Merge commit with semi-linear history. A merge commit is still created, but only when the source branch is up to date with the target. If it is not, GitLab offers a rebase.
  • Fast-forward merge. No merge commit. The merge is allowed only if the branch can be fast-forwarded.

Squash is a separate project setting on GitLab: do not allow, allow, encourage, or require. So “squash and merge” is a button on GitHub and a checkbox on top of the merge method on GitLab.

Fetching one to your laptop

Each host keeps a special ref for every request, so you can fetch someone’s change by its number. The first line is GitHub. The second is GitLab.

git fetch origin pull/12/head:pr-12
git fetch origin merge-requests/12/head:mr-12

What this changes for an AI code pipeline

Nothing about the shape. The review seat sits on the request, whatever the host calls it. A model reads the diff when the request opens, comments on the change, and a human still owns the merge. Add AI to your review pipeline walks through that seat.

It does change which tool you can install, because review tools connect to one host’s API. Mergestorm, the tool we build, is built for GitHub pull requests. It does not review GitLab merge requests.

Questions people ask

Is a merge request the same as a pull request?

Yes. Both are a request to review the commits on one branch and merge them into another branch. Pull request is the name on GitHub. Merge request is the name on GitLab. The review, the checks and the merge work the same way in outline.

Why does GitHub call it a pull request?

Because you are asking the maintainer to pull your branch into theirs. Git has had a command with that idea for a long time: git request-pull writes a summary that asks an upstream project to pull your changes. GitHub built a web page around the same ask.

Why does GitLab call it a merge request?

GitLab names it after the action you are asking for at the end: merge this branch. It is the same request, described from the other side.

What do PR and MR stand for?

PR is pull request. MR is merge request. On GitHub a pull request is referenced with a number sign, like #12. On GitLab a merge request is referenced with an exclamation mark, like !12.

Is a draft merge request the same as a draft pull request?

In effect, yes. Neither can be merged until it is marked ready. On GitHub you choose Create draft pull request and later click Ready for review. On GitLab you select Mark as draft, or start the title with Draft:, and later select Mark as ready.

What happened to WIP merge requests in GitLab?

WIP, for work in progress, was GitLab's older name for a draft merge request. GitLab renamed it to Draft in version 13.2 and later removed the WIP prefix. Use Draft: now.

Does Bitbucket use pull request or merge request?

Pull request. Bitbucket uses the same name as GitHub. Merge request is the GitLab name.

Is a pull request or a merge request part of Git?

No. Git has commits, branches and merges. The pull request and the merge request are features of the host, which is why the name changes when the host changes and the Git commands do not. Commit vs pull request covers the Git side.

Next lesson

You have the words on both hosts. Now put a model in a named seat on that path.

What is an AI code pipeline?