GitLab CLI (glab) Assistant
You have access to the glab CLI for GitLab operations. $ARGUMENTS
Authentication
If there are authentication related errors, run: glab auth status
Command Reference
Issues
- •
glab issue list [--assignee=@me] [--label=X] [--milestone=X] [--state=opened|closed|all] - •
glab issue view <id> --comments - •
glab issue create --title "X" --description "X" [--label=X] [--assignee=X] - •
glab issue close <id> - •
glab issue update <id> [--title=X] [--description=X] [--label=X] [--assignee=X] - •
glab issue note <id> --message "X"(add comment)
Merge Requests
- •
glab mr list [--assignee=@me] [--reviewer=@me] [--state=opened|merged|closed|all] [--label=X] - •
glab mr view <id> --comments - •
glab mr diff <id>(view changes) - •
glab mr create --title "X" --description "X" [--source-branch=X] [--target-branch=X] [--related-issue=X] - •
glab mr update <id> [--title=X] [--description=X] [--label=X] [--draft] [--ready] - •
glab mr close <id> - •
glab mr checkout <id>(switch to MR branch locally) - •
glab mr approve <id> - •
glab mr merge <id> [--squash] [--remove-source-branch] - •
glab mr note <id> --message "X"(add comment)
CI/CD Pipelines
- •
glab ci list(list recent pipelines) - •
glab ci view [branch](interactive pipeline viewer) - •
glab ci status(current branch pipeline status) - •
glab ci trace [job-id](view job logs) - •
glab pipeline run --branch <branch>(trigger pipeline) - •
glab ci retry <job-id> - •
glab ci cancel pipeline <id> - •
glab ci cancel job <id>
Releases & Tags
- •
glab release list - •
glab release view <tag> - •
glab release create <tag> --notes "X"
Labels & Milestones
- •
glab label list [-F json] - •
glab milestone list [--state=active|closed]
Repository Info
- •
glab repo view(project metadata) - •
glab api projects/:id/repository/commits(recent commits via API)
Raw API Access
- •
glab api <endpoint> --method GET|POST|PUT|DELETE - •
glab api graphql --field query='...'
Key Flags
- •
-R owner/repoor--repo- target different repository (supports GROUP/NAMESPACE/REPO format) - •
--hostname- target specific GitLab instance - •
-F jsonor--output json- machine-readable output (prefer this for parsing) - •
-wor--web- open in browser - •
--per-page N- control result count (default 30) - •
--page N- pagination
Workflow Patterns
Summarize Feature/Epic Status
- •Find related issues:
glab issue list --label=<feature-label> -F json - •Find related MRs:
glab mr list --label=<feature-label> -F json - •For each open MR, check pipeline:
glab ci status --branch <source-branch> - •Optionally review code:
glab mr diff <id>or checkout and read files
Review an MR Thoroughly
- •
glab mr view <id> --comments(understand context and discussion) - •
glab mr diff <id>(see all changes) - •
glab mr checkout <id>(get code locally) - •Check CI:
glab ci status - •Add feedback:
glab mr note <id> --message "..."
Debug Failed Pipeline
- •
glab ci list -F json(find failed pipeline) - •
glab ci view(identify failed job) - •
glab ci trace <job-id>(read full logs) - •Suggest fix or create issue
Prepare Release Summary
- •
glab release list(find previous tag) - •
glab api projects/:id/repository/compare?from=<old>&to=<new>(commits between) - •
glab mr list --state=merged --updated-after=<date> -F json - •
glab issue list --state=closed --updated-after=<date> -F json
Triage My Work
- •
glab issue list --assignee=@me --state=opened -F json - •
glab mr list --assignee=@me --state=opened -F json - •
glab mr list --reviewer=@me --state=opened -F json
Review Tickets Workflow
When reviewing ticket status against codebase:
- •List open issues:
glab issue list --assignee=@me --state=opened -F json - •For each issue, search git history:
git log --oneline --grep="<issue-id>" - •Check if related MRs are merged:
glab mr list --state=merged | grep "<issue-id>" - •Update issue status or add comments as needed
Important Notes
- •Always use
-F jsonwhen you need to parse output programmatically - •Pipeline status: passed, failed, running, pending, canceled, skipped
- •The
glab apicommand can access any GitLab REST endpoint for advanced queries - •Rate limits apply; batch operations thoughtfully