| name | 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/REPO or GROUP/NAMESPACE/REPO
- Output format matters: Use
--output json for scripting, default for readability
- Prefer flags over interactive: Use flags (
-t, -d, -l) for reproducible, non-interactive commands
- Current branch context: Many
mr and ci commands auto-detect the current branch's MR or pipeline
Authentication
Authenticate before running any glab command.
glab auth login
glab auth login --hostname gitlab.example.com
echo "glpat-xxxxxxxxxxxx" | glab auth login --stdin --hostname gitlab.example.com
glab auth status
glab auth logout
Issues
Create
glab issue create
glab issue create -t "Implement feature X" -d "Detailed description here"
glab issue create -t "Fix login bug" -l "bug,critical" -m "v2.0" -a "username"
glab issue create -t "Fix CVE-YYYY-XXXX" -l security --linked-mr 123
glab issue create -t "New feature" --web
glab issue create --recover
View
glab issue view 42
glab issue view 42 --comments --system-logs
glab issue view 42 --web
glab issue view 42 -R group/project
List
glab issue list
glab issue list --closed
glab issue list -A
glab issue list -l "bug,critical"
glab issue list --assignee "username"
glab issue list -m "v2.0"
glab issue list --search "login"
glab issue list --output json
glab issue list --per-page 50 --page 2
Close / Reopen
glab issue close 42
glab issue reopen 42
Note (Comment)
glab issue note 42 -m "This is fixed in MR !123"
glab issue note 42
Board
glab issue board view
glab issue board view --assignee "username"
glab issue board view --labels "bug,frontend"
glab issue board view --milestone "v2.0"
Merge Requests
Create
glab mr create
glab mr create -t "Add user authentication" -d "Implements OAuth2 login flow"
glab mr create --fill
glab mr create -t "WIP: New feature" --draft
glab mr create -t "Fix bug" -l "bugfix" -a "dev" --reviewer "reviewer1,reviewer2"
glab mr create --source-branch feature/auth --target-branch main
glab mr create -t "Feature" --squash-before-merge
glab mr create -t "Feature" --remove-source-branch
glab mr create -t "Feature" -m "v2.0"
glab mr create -t "Feature" --web
List
glab mr list
glab mr list --merged
glab mr list --assignee "username"
glab mr list --reviewer "username"
glab mr list -l "needs-review"
glab mr list --search "auth"
glab mr list --output json
View
glab mr view 123
glab mr view
glab mr view 123 --web
Checkout
glab mr checkout 123
glab mr checkout feature-branch
glab mr checkout "https://gitlab.com/group/project/-/merge_requests/123"
Diff
glab mr diff 123
glab mr diff
glab mr diff 123 --raw
glab mr diff 123 --color=never
Merge
glab mr merge 123
glab mr merge 123 --squash
glab mr merge 123 --remove-source-branch
glab mr merge 123 --when-pipeline-succeeds
glab mr merge
Approve / Revoke
glab mr approve 123
glab mr approve 123 345
glab mr approve 123 --sha abc123def
glab mr approve
glab mr revoke 123
Rebase
glab mr rebase 123
glab mr rebase
glab mr rebase 123 --skip-ci
Note (Comment)
glab mr note 123 -m "Looks good to me!"
glab mr note 123
Update
glab mr update 123 --title "Updated title"
glab mr update 123 --description "New description"
glab mr update 123 --draft
glab mr update 123 --ready
glab mr update 123 --label "reviewed,approved"
glab mr update 123 --assignee "username"
glab mr update 123 --lock-discussion
Close / Reopen / Delete
glab mr close 123
glab mr reopen 123
glab mr delete 123
Other MR Operations
glab mr approvers 123
glab mr issues 123
glab mr subscribe 123
glab mr unsubscribe 123
glab mr todo 123
CI/CD Pipelines & Jobs
Pipeline Status
glab ci status
glab ci status --live
glab ci status --web
List Pipelines
glab ci list
glab ci list --branch main
glab ci list --output json
View Pipeline / Job
glab ci view
glab ci view main
Retry Jobs
glab ci retry
glab ci retry 224356863
glab ci retry lint
glab ci retry lint --branch main
Run Pipeline
glab ci run
glab ci run --branch main
Trigger Pipeline
glab ci run-trig -t <CI_JOB_TOKEN>
glab ci run-trig -t <CI_JOB_TOKEN> -b main --variables key1:val1,key2:val2
glab ci run-trig -t <CI_JOB_TOKEN> -b main --input "replicas:int(3)" --input "debug:bool(false)"
Lint CI Config
glab ci lint
glab ci lint path/to/.gitlab-ci.yml
Releases
Create
glab release create v1.0.0
glab release create v1.0.0 -n "Release notes here"
glab release create v1.0.0 -F changelog.md
glab release create v1.0.0 ./build/app.zip ./build/app.tar.gz
glab release create v1.0.0 -m "v1.0.0"
glab release create v1.0.0 --name "Production Release 1.0"
glab release create v1.0.0 --tag-message "Version 1.0.0"
glab release create v1.0.0 --released-at "2026-03-30T12:00:00Z"
List
glab release list
View
glab release view
glab release view v1.0.0
glab release view v1.0.0 --web
Delete
glab release delete v1.0.0
Repository
Clone
glab repo clone group/project
glab repo clone group/project my-local-dir
Fork
glab repo fork
glab repo fork group/project
glab repo fork group/project --clone
glab repo fork group/project --name "my-fork" --path "my-fork-path"
View
glab repo view
glab repo view group/project
glab repo view --web
Labels
glab label create "bug" --color "#ff0000" --description "Bug reports"
glab label list
glab label get 1234
glab label edit "bug" --color "#cc0000" --description "Updated description"
glab label delete "bug"
Variables
glab variable set MY_VAR "my_value"
glab variable set MY_VAR "my_value" --description "API key for service X"
glab variable set SECRET_TOKEN "s3cret" --masked
glab variable set PROD_KEY "value" --protected
glab variable set HIDDEN_VAR "value" --hidden
glab variable set DB_HOST "prod-db.example.com" --scope "production"
glab variable set GROUP_VAR "value" -g mygroup
glab variable set SERVER_CERT < cert.pem
cat token.txt | glab variable set API_TOKEN
glab variable list
glab variable list -g mygroup
glab variable list --output json
glab variable get MY_VAR
glab variable delete MY_VAR
Snippets
glab snippet create --title "My snippet" --filename "main.go"
glab snippet create --title "Notes" --filename "notes.md" --personal
glab snippet create --title "Public snippet" --filename "example.sh" --visibility public
Milestones
glab milestone create --title "v2.0" --description "Version 2.0 release"
glab milestone create --title "v2.0" --start-date "2026-04-01" --due-date "2026-06-30"
glab 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
git push -u origin HEAD
glab mr create --fill --draft
Review and Merge an MR
glab mr checkout 123
glab mr diff 123
glab mr approve 123
glab mr merge 123 --squash --remove-source-branch
Triage Issues
glab issue list -l "bug" --assignee ""
glab issue update 42 --assignee "dev" --label "priority::high"
Check Pipeline and Retry
glab ci status
glab ci retry lint
glab ci run
Create a Release
git tag -a v1.2.0 -m "Release v1.2.0"
git push origin v1.2.0
glab release create v1.2.0 -F CHANGELOG.md ./dist/app.zip
Work with Issues and MRs Together
glab issue create -t "Add dark mode" -l "feature"
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
glab mr list --output json | jq '.[].iid'
glab issue list --output json | jq '.[] | {title, state}'
glab mr list --output json | jq 'group_by(.author.username) | map({author: .[0].author.username, count: length})'