LinuxCommandLibrary

glab-mr

Create, view, and manage GitLab merge requests

TLDR

Create a merge request

$ glab mr create
copy

Check out a specific merge request locally
$ glab mr checkout [mr_number]
copy

View the changes made in the merge request
$ glab mr diff
copy

Approve the merge request for the current branch
$ glab mr approve
copy

Merge the merge request associated with the current branch interactively
$ glab mr merge
copy

Edit a merge request interactively
$ glab mr update
copy

Edit the target branch of a merge request
$ glab mr update --target-branch [branch_name]
copy

SYNOPSIS

glab mr [<command>] [<flags>]

PARAMETERS

--help
    Show help for command

--verbose
    Enable verbose logging output

-R, --repo OWNER/REPO
    Select repository (default current if in git repo)

--paginate
    Enable pagination (auto-disabled if output to pipe/redirect)

--limit FROM..TO
    Limit results returned (default 100)

DESCRIPTION

glab mr is the merge request subcommand of the official GitLab CLI tool glab, enabling seamless management of merge requests (MRs) directly from the terminal. It mirrors familiar git workflows, allowing users to create, list, approve, merge, comment, rebase, and perform other actions on MRs without switching to the web UI.

Key capabilities include filtering MRs by state (opened, closed, merged), assignee, author, or labels; creating MRs from branches with custom titles and descriptions; approving or unapproving in bulk; adding notes; viewing diffs; and integrating with pipelines. Supports interactive mode for prompts and works across projects via repository flags.

Designed for developers and CI/CD automation, it leverages GitLab API for real-time operations. Authentication via personal access token is required, set with glab auth login. Enhances productivity in terminal-centric environments, especially monorepos or remote teams.

CAVEATS

Requires GitLab authentication (glab auth login). Subcommand-specific flags apply (e.g., --title for create). Not all features available on all GitLab versions; check compatibility.

COMMON SUBCOMMANDS

create: Create new MR
list: List MRs (e.g., glab mr list --state opened)
approve: Approve MR(s)
merge: Merge MR(s)
view: View MR details
Full list: glab mr --help

EXAMPLES

glab mr create --title 'Fix bug' --description 'Details'
glab mr list --author=@me --state=opened
glab mr approve <MR-ID>

HISTORY

Part of glab, first released by GitLab in November 2021 (v1.0.0). MR subcommands evolved from community feedback, with major enhancements in v1.14+ for squash/merge and reviewers. Actively maintained as open-source (Apache-2.0).

SEE ALSO

glab(1), git(1), gh pr(1)

Copied to clipboard