glab mr
Create, view, and manage GitLab merge requests.
Quick start
# Create MR from current branch
glab mr create --fill
# List my MRs
glab mr list --assignee=@me
# Review an MR
glab mr checkout 123
glab mr diff
glab mr approve
# Merge an MR
glab mr merge 123 --when-pipeline-succeeds --remove-source-branch
Common workflows
Creating MRs
From current branch:
glab mr create --fill --label bugfix --assignee @reviewer
From issue:
glab mr for 456 # Creates MR linked to issue #456
Draft MR:
glab mr create --draft --title "WIP: Feature X"
Review workflow
List pending reviews:
glab mr list --reviewer=@me --state=openedCheckout and test:
glab mr checkout 123 npm testLeave feedback:
glab mr note 123 -m "Looks good, one question about the cache logic"Approve:
glab mr approve 123
Automated review workflow:
For repetitive review tasks, use the automation script:
scripts/mr-review-workflow.sh 123
scripts/mr-review-workflow.sh 123 "pnpm test"
This automatically: checks out → runs tests → posts result → approves if passed.
Merge strategies
Auto-merge when pipeline passes:
glab mr merge 123 --when-pipeline-succeeds --remove-source-branch
Squash commits:
glab mr merge 123 --squash
Rebase before merge:
glab mr rebase 123
glab mr merge 123
Troubleshooting
Merge conflicts:
- Checkout MR:
glab mr checkout 123 - Resolve conflicts manually in your editor
- Commit resolution:
git add . && git commit - Push:
git push
Cannot approve MR:
- Check if you're the author (can't self-approve in most configs)
- Verify permissions:
glab mr approvers 123 - Ensure MR is not in draft state
Pipeline required but not running:
- Check
.gitlab-ci.ymlexists in branch - Verify CI/CD is enabled for project
- Trigger manually:
glab ci run
"MR already exists" error:
- List existing MRs from branch:
glab mr list --source-branch <branch> - Close old MR if obsolete:
glab mr close <id> - Or update existing:
glab mr update <id> --title "New title"
Related Skills
Working with issues:
- See
glab-issuefor creating/managing issues - Use
glab mr for <issue-id>to create MR linked to issue - Script:
scripts/create-mr-from-issue.shautomates branch + MR creation
CI/CD integration:
- See
glab-cifor pipeline status before merging - Use
glab mr merge --when-pipeline-succeedsfor auto-merge
Automation:
- Script:
scripts/mr-review-workflow.shfor automated review + test workflow
Command reference
For complete command documentation and all flags, see references/commands.md.
Available commands:
approve- Approve merge requestscheckout- Check out an MR locallyclose- Close merge requestcreate- Create new MRdelete- Delete merge requestdiff- View changes in MRfor- Create MR for an issuelist- List merge requestsmerge- Merge/accept MRnote- Add comment to MRrebase- Rebase source branchreopen- Reopen merge requestrevoke- Revoke approvalsubscribe/unsubscribe- Manage notificationstodo- Add to-do itemupdate- Update MR metadataview- Display MR details