| name | glab |
| description | GitLab CLI (glab) for merge requests, issues, and CI/CD pipelines. Use when working with GitLab repositories for MR creation/review, issue management, pipeline debugging, or any GitLab API operations. Triggers on GitLab URLs, mentions of "merge request" or "MR" (not "PR"), gitlab.com, or glab commands. |
glab - GitLab CLI
Quick Reference
glab auth login
glab auth status
glab mr create
glab mr list
glab mr view <id>
glab mr merge <id>
glab mr checkout <id>
glab issue create
glab issue list
glab issue view <id>
glab issue close <id>
glab ci status
glab ci view
glab ci list
glab ci trace
MR Creation Flow
glab mr create \
--title "feat: add user authentication" \
--description "Implements OAuth2 login flow" \
--assignee @me \
--reviewer @teammate \
--label "feature,needs-review" \
--milestone "v1.0"
glab mr create --draft --title "WIP: refactoring auth"
glab mr create --target-branch develop
glab mr create --push
MR Review Workflow
glab mr list --reviewer=@me
glab mr checkout 42
glab mr approve 42
glab mr merge 42 --squash --remove-source-branch
Issue Management
Creating Issues with Descriptions
Simple inline description:
glab issue create --title "Fix login bug" --description "Users cannot log in"
Multiline descriptions - use $'...' syntax for newlines:
glab issue create \
--title "Bug: login fails on mobile" \
--description $'## Summary\nLogin fails on iOS devices.\n\n## Steps to Reproduce\n1. Open app\n2. Tap login\n3. Enter credentials\n\n## Expected\nUser logs in successfully'
Complex descriptions - use a temp file (most reliable):
cat << 'EOF' > /tmp/issue-body.md
Login fails on iOS devices when using OAuth.
1. Open the app on iOS 17+
2. Tap "Login with Google"
3. Complete OAuth flow
4. App crashes on redirect
User should be logged in and see dashboard.
- iOS 17.2
- App version 2.3.1
EOF
glab issue create \
--title "Bug: OAuth login crashes on iOS" \
--label "bug,priority::high" \
--assignee @me \
< /tmp/issue-body.md
Interactive mode (opens editor):
glab issue create
Updating Issues
glab issue update 123 -d "New description here"
glab issue update 123 -d $'## Updated\n\nNew multiline description'
glab issue update 123 -d -
glab issue update 123 -d "$(cat /tmp/new-description.md)"
glab issue update 123 --title "New title"
glab issue update 123 -l "in-progress"
glab issue update 123 --unlabel "needs-triage"
glab issue update 123 --assignee @teammate
glab issue update 123 --milestone "v1.0"
Note: For very complex updates, the API gives more control:
glab api --method PUT projects/:fullpath/issues/123 \
-f description="$(cat /tmp/description.md)"
Issue Search and Filtering
glab issue list --search "authentication"
glab issue list --label "bug"
glab issue list --label "bug" --label "priority::high"
glab issue list --assignee @me
glab issue list --author @me
glab issue list --closed
glab issue list --milestone "v1.0"
Linking Issues to MRs
In MR descriptions, use keywords to auto-close issues on merge:
Closes #123
Fixes #123
Resolves #123
glab issue close 123
glab issue reopen 123
Pipeline Debugging
glab ci status
glab ci list
glab ci list --status=failed
glab ci view
glab ci view main
Job Operations
glab ci trace
glab ci trace build
glab ci trace 224356863
glab ci retry deploy
glab ci retry 224356863
glab ci trigger deploy-production
glab ci cancel pipeline
glab ci cancel job 224356863
Artifacts
glab job artifact main build
glab job artifact main build --path="./artifacts/"
Project Operations
glab repo clone owner/repo
glab repo fork owner/repo
glab repo view --web
glab api projects/:id/members
Tips
- Use
--web or -w flag to open result in browser
- Use
glab alias set to create shortcuts
- Environment variable
GITLAB_TOKEN for CI/CD auth
- Use
glab api for any GitLab API endpoint not covered by commands