Skill v1.0.0
currentAutomated scan100/100name: glab-cli description: This skill should be used when the user asks to "run glab commands", "create a GitLab issue", "create a merge request", "check pipeline status", "manage GitLab projects", "create a release", or mentions glab, GitLab CLI, gitlab-cli, merge request, MR, GitLab pipeline, GitLab CI, GitLab issue keys, or gitlab operations via the command line. version: 1.0.0
GLAB CLI Command Reference
Quick-reference for the GitLab CLI (glab). Covers authentication, issues, merge requests, CI/CD pipelines, releases, repo management, labels, variables, snippets, and milestones.
Core Principles
- Authenticate first: Verify auth status before running commands
- Use `-R` for cross-repo: Target any repo with
-R OWNER/REPOorGROUP/NAMESPACE/REPO - Output format matters: Use
--output jsonfor scripting, default for readability - Prefer flags over interactive: Use flags (
-t,-d,-l) for reproducible, non-interactive commands - Current branch context: Many
mrandcicommands auto-detect the current branch's MR or pipeline
Authentication
Authenticate before running any glab command.
# Interactive login (browser-based OAuth flow)glab auth login# Login to a self-managed instanceglab auth login --hostname gitlab.example.com# Login with token from stdinecho "glpat-xxxxxxxxxxxx" | glab auth login --stdin --hostname gitlab.example.com# Check current auth statusglab auth status# Log outglab auth logout
Issues
Create
# Interactive creationglab issue create# Create with inline fieldsglab issue create -t "Implement feature X" -d "Detailed description here"# Create with labels, milestone, and assigneeglab issue create -t "Fix login bug" -l "bug,critical" -m "v2.0" -a "username"# Create with linked merge requestglab issue create -t "Fix CVE-YYYY-XXXX" -l security --linked-mr 123# Create and open in browserglab issue create -t "New feature" --web# Recover a previously started issue creationglab issue create --recover
View
# View issue detailsglab issue view 42# View with comments and activityglab issue view 42 --comments --system-logs# Open issue in browserglab issue view 42 --web# View from a different repoglab issue view 42 -R group/project
List
# List open issuesglab issue list# List closed issuesglab issue list --closed# List all issues (open + closed)glab issue list -A# Filter by labelsglab issue list -l "bug,critical"# Filter by assigneeglab issue list --assignee "username"# Filter by milestoneglab issue list -m "v2.0"# Search by keywordglab issue list --search "login"# Output as JSONglab issue list --output json# Paginate resultsglab issue list --per-page 50 --page 2
Close / Reopen
# Close an issueglab issue close 42# Reopen an issueglab issue reopen 42
Note (Comment)
# Add a commentglab issue note 42 -m "This is fixed in MR !123"# Open editor to compose a multi-line commentglab issue note 42
Board
# View project issue boardglab issue board view# Filter board by assigneeglab issue board view --assignee "username"# Filter board by labelsglab issue board view --labels "bug,frontend"# Filter board by milestoneglab issue board view --milestone "v2.0"
Merge Requests
Create
# Interactive creationglab mr create# Create with title and descriptionglab mr create -t "Add user authentication" -d "Implements OAuth2 login flow"# Create with auto-fill from commitsglab mr create --fill# Create as draftglab mr create -t "WIP: New feature" --draft# Create with labels, assignee, and reviewerglab mr create -t "Fix bug" -l "bugfix" -a "dev" --reviewer "reviewer1,reviewer2"# Create with specific source and target branchesglab mr create --source-branch feature/auth --target-branch main# Create with squash on mergeglab mr create -t "Feature" --squash-before-merge# Create and remove source branch on mergeglab mr create -t "Feature" --remove-source-branch# Create with milestoneglab mr create -t "Feature" -m "v2.0"# Create and open in browserglab mr create -t "Feature" --web
List
# List open MRsglab mr list# List merged MRsglab mr list --merged# List MRs by assigneeglab mr list --assignee "username"# List MRs by reviewerglab mr list --reviewer "username"# List MRs by labelglab mr list -l "needs-review"# Search by keywordglab mr list --search "auth"# Output as JSONglab mr list --output json
View
# View MR detailsglab mr view 123# View MR from current branchglab mr view# Open MR in browserglab mr view 123 --web
Checkout
# Checkout MR by IDglab mr checkout 123# Checkout MR by branch nameglab mr checkout feature-branch# Checkout MR by URLglab mr checkout "https://gitlab.com/group/project/-/merge_requests/123"
Diff
# View MR diffglab mr diff 123# View diff from current branch's MRglab mr diff# View raw diff (for piping)glab mr diff 123 --raw# View diff without colorglab mr diff 123 --color=never
Merge
# Merge MRglab mr merge 123# Merge with squashglab mr merge 123 --squash# Merge and remove source branchglab mr merge 123 --remove-source-branch# Merge when pipeline succeedsglab mr merge 123 --when-pipeline-succeeds# Merge current branch's MRglab mr merge
Approve / Revoke
# Approve MRglab mr approve 123# Approve multiple MRsglab mr approve 123 345# Approve MR matching specific SHAglab mr approve 123 --sha abc123def# Approve current branch's MRglab mr approve# Revoke approvalglab mr revoke 123
Rebase
# Rebase MR source branchglab mr rebase 123# Rebase current branch's MRglab mr rebase# Rebase and skip CIglab mr rebase 123 --skip-ci
Note (Comment)
# Add a comment to MRglab mr note 123 -m "Looks good to me!"# Open editor for multi-line commentglab mr note 123
Update
# Update MR titleglab mr update 123 --title "Updated title"# Update MR descriptionglab mr update 123 --description "New description"# Mark MR as draftglab mr update 123 --draft# Mark MR as readyglab mr update 123 --ready# Add labelsglab mr update 123 --label "reviewed,approved"# Set assigneeglab mr update 123 --assignee "username"# Lock discussionglab mr update 123 --lock-discussion
Close / Reopen / Delete
# Close MRglab mr close 123# Reopen MRglab mr reopen 123# Delete MRglab mr delete 123
Other MR Operations
# List approvers for MRglab mr approvers 123# List issues closed by MRglab mr issues 123# Subscribe to MR notificationsglab mr subscribe 123# Unsubscribe from MRglab mr unsubscribe 123# Add MR to your todo listglab mr todo 123
CI/CD Pipelines & Jobs
Pipeline Status
# View current branch pipeline status (interactive)glab ci status# View pipeline status with live updatesglab ci status --live# View pipeline in browserglab ci status --web
List Pipelines
# List recent pipelinesglab ci list# List pipelines for a specific branchglab ci list --branch main# Output as JSONglab ci list --output json
View Pipeline / Job
# View pipeline details (interactive job selection)glab ci view# View specific branch pipelineglab ci view main
Retry Jobs
# Interactively select a job to retryglab ci retry# Retry specific job by IDglab ci retry 224356863# Retry job by nameglab ci retry lint# Retry job on specific branchglab ci retry lint --branch main
Run Pipeline
# Run pipeline on current branchglab ci run# Run pipeline on specific branchglab ci run --branch main
Trigger Pipeline
# Trigger pipeline with tokenglab ci run-trig -t <CI_JOB_TOKEN># Trigger on specific branch with variablesglab ci run-trig -t <CI_JOB_TOKEN> -b main --variables key1:val1,key2:val2# Trigger with typed inputsglab ci run-trig -t <CI_JOB_TOKEN> -b main --input "replicas:int(3)" --input "debug:bool(false)"
Lint CI Config
# Lint .gitlab-ci.ymlglab ci lint# Lint a specific fileglab ci lint path/to/.gitlab-ci.yml
Releases
Create
# Create release with tagglab release create v1.0.0# Create with release notesglab release create v1.0.0 -n "Release notes here"# Create with notes from fileglab release create v1.0.0 -F changelog.md# Create with asset filesglab release create v1.0.0 ./build/app.zip ./build/app.tar.gz# Create with milestone associationglab release create v1.0.0 -m "v1.0.0"# Create with custom nameglab release create v1.0.0 --name "Production Release 1.0"# Create with tag message (annotated tag)glab release create v1.0.0 --tag-message "Version 1.0.0"# Create with custom release dateglab release create v1.0.0 --released-at "2026-03-30T12:00:00Z"
List
# List releasesglab release list
View
# View latest releaseglab release view# View specific releaseglab release view v1.0.0# View in browserglab release view v1.0.0 --web
Delete
# Delete a releaseglab release delete v1.0.0
Repository
Clone
# Clone a repositoryglab repo clone group/project# Clone to specific directoryglab repo clone group/project my-local-dir
Fork
# Fork current repoglab repo fork# Fork a specific repoglab repo fork group/project# Fork and cloneglab repo fork group/project --clone# Fork with custom name and pathglab repo fork group/project --name "my-fork" --path "my-fork-path"
View
# View repo detailsglab repo view# View specific repoglab repo view group/project# Open in browserglab repo view --web
Labels
# Create a labelglab label create "bug" --color "#ff0000" --description "Bug reports"# List all labelsglab label list# Get label detailsglab label get 1234# Edit a labelglab label edit "bug" --color "#cc0000" --description "Updated description"# Delete a labelglab label delete "bug"
Variables
# Set a variableglab variable set MY_VAR "my_value"# Set with descriptionglab variable set MY_VAR "my_value" --description "API key for service X"# Set a masked variableglab variable set SECRET_TOKEN "s3cret" --masked# Set a protected variableglab variable set PROD_KEY "value" --protected# Set a hidden variableglab variable set HIDDEN_VAR "value" --hidden# Set variable with environment scopeglab variable set DB_HOST "prod-db.example.com" --scope "production"# Set variable for a groupglab variable set GROUP_VAR "value" -g mygroup# Set variable from fileglab variable set SERVER_CERT < cert.pem# Set variable from stdincat token.txt | glab variable set API_TOKEN# List project variablesglab variable list# List group variablesglab variable list -g mygroup# List as JSONglab variable list --output json# Get a specific variableglab variable get MY_VAR# Delete a variableglab variable delete MY_VAR
Snippets
# Create a snippet from fileglab snippet create --title "My snippet" --filename "main.go"# Create a personal snippetglab snippet create --title "Notes" --filename "notes.md" --personal# Set visibilityglab snippet create --title "Public snippet" --filename "example.sh" --visibility public
Milestones
# Create a milestoneglab milestone create --title "v2.0" --description "Version 2.0 release"# Create with datesglab milestone create --title "v2.0" --start-date "2026-04-01" --due-date "2026-06-30"# List milestonesglab milestone list
Common Flag Patterns
| Flag | Short | Purpose | |
|---|---|---|---|
--output json | Output as JSON | ||
--web | -w | Open in browser | |
--help | -h | Show command help | |
--repo OWNER/REPO | -R | Target a different repository | |
--page | -p | Page number for pagination | |
--per-page | -P | Items per page | |
--title | -t | Set title (issues, MRs) | |
--description | -d | Set description | |
--label | -l | Add labels (comma-separated) | |
--milestone | -m | Set milestone | |
--assignee | -a | Set assignee | |
--branch | -b | Target branch | |
--draft | Mark MR as draft | ||
--squash | Squash commits on merge | ||
--remove-source-branch | Delete source branch after merge |
Common Workflows
Create MR from Current Branch
# Push branch and create MR in one flowgit push -u origin HEADglab mr create --fill --draft
Review and Merge an MR
# Checkout the MR locallyglab mr checkout 123# View the diffglab mr diff 123# Approve and mergeglab mr approve 123glab mr merge 123 --squash --remove-source-branch
Triage Issues
# List unassigned bugsglab issue list -l "bug" --assignee ""# Assign and labelglab issue update 42 --assignee "dev" --label "priority::high"
Check Pipeline and Retry
# Check current pipeline statusglab ci status# If a job failed, retry itglab ci retry lint# Or run a fresh pipelineglab ci run
Create a Release
# Tag, create release, attach assetsgit tag -a v1.2.0 -m "Release v1.2.0"git push origin v1.2.0glab release create v1.2.0 -F CHANGELOG.md ./dist/app.zip
Work with Issues and MRs Together
# Create issue, then create MR that closes itglab issue create -t "Add dark mode" -l "feature"# ... implement on branch ...glab mr create -t "Add dark mode" -d "Closes #42" --fill
Output Formatting Tips
Use --output json for scripting/piping. Default output is human-readable. Add --per-page and --page for pagination. The --web flag opens any resource in your browser.
JSON + jq Piping
# Extract MR IDsglab mr list --output json | jq '.[].iid'# Get issue titles and statesglab issue list --output json | jq '.[] | {title, state}'# Count open MRs by authorglab mr list --output json | jq 'group_by(.author.username) | map({author: .[0].author.username, count: length})'