Merge Requests

mgfrantzCode & ReviewsNot reviewed by BB
Get it for macOS

Review, approve, and merge GitHub pull requests and GitLab merge requests without leaving a thread. List open changes with CI, conflict, and review state, read the full diff, and act from the `bb mr` command set or agent tools. Merge now or arm auto-merge so CI gates the merge; `--head-sha` refuses to merge a branch that moved since it was read. Requires the `gh` or `glab` CLI, authenticated with `gh auth login` or `glab auth login`; the plugin stores no credentials.


What you get

One command set covers both GitHub and GitLab from inside a bb thread: open or closed change requests with their CI, conflict, review, and label state; the full description, per-job CI checks, approvals, reviewers, comments, and diff of one change; and every review action — comment, approve, request changes, merge, auto-merge, labels, and lifecycle (ready, draft, close, reopen).

Without repository flags, the current checkout's origin decides GitHub or GitLab. Pass --github owner/name or --gitlab group/project — plus --host for a self-hosted GitLab instance — to act outside the checkout.

Merge safety is explicit: mr merge takes a merge method, can arm or cancel auto-merge so CI gates the merge, can delete the source branch, and takes --head-sha to refuse merging a branch that moved since it was read. On GitLab, mr update-branch rebases the source branch; on GitHub, mr revert opens a revert pull request.

Agent tools

The plugin registers mr_list, mr_view, mr_create, mr_comment, mr_review, mr_merge, and mr_tag agent tools, so a thread can drive the whole review loop without a shell. A bundled merge-requests skill teaches agents the workflow, including checking CI and conflicts with mr_view before merging.

How it runs

Subprocesses never run in the server. The plugin ships a host entry: the server resolves the invoking thread's host, calls the entry through host RPC, and that entry runs gh, glab, and git on the machine that holds the checkout and the CLI credentials.

Per-host capabilities are declared, not assumed. GitHub offers merge, squash, rebase, auto-merge, revert, and request-changes. GitLab offers merge, squash, auto-merge (pipeline-based), and request-changes on GitLab 17.2 or newer. Asking a host for something it cannot do returns a clean error, never a wrong action.

Requirements

  • GitHub: the gh CLI, authenticated with gh auth login or a GH_TOKEN in the daemon environment.
  • GitLab: the glab CLI, authenticated with glab auth login or a GL_TOKEN.
  • Install and authenticate on each machine that will act on repositories; the plugin stores no credentials itself.
  • Optional: explicit gh/glab binary paths through bb plugin config merge-requests when the daemon's PATH misses them. The plugin also probes /opt/homebrew/bin, /usr/local/bin, /usr/bin, and /snap/bin.

More in Code & Reviews 70

Work with repositories, builds, changes, pull requests, issues, and reviews.

View all