Source Code
GitLab CLI Skills
Comprehensive GitLab CLI (glab) command reference and workflows.
Quick start
# First time setup
glab auth login
# Common operations
glab mr create --fill # Create MR from current branch
glab issue create # Create issue
glab ci view # View pipeline status
glab repo view --web # Open repo in browser
Skill organization
This skill routes to specialized sub-skills by GitLab domain:
Core Workflows:
glab-mr- Merge requests: create, review, approve, mergeglab-issue- Issues: create, list, update, close, commentglab-ci- CI/CD: pipelines, jobs, logs, artifactsglab-repo- Repositories: clone, create, fork, manage
Project Management:
glab-milestone- Release planning and milestone trackingglab-iteration- Sprint/iteration managementglab-label- Label management and organizationglab-release- Software releases and versioning
Authentication & Config:
glab-auth- Login, logout, Docker registry authglab-config- CLI configuration and defaultsglab-ssh-key- SSH key managementglab-gpg-key- GPG keys for commit signingglab-token- Personal and project access tokens
CI/CD Management:
glab-job- Individual job operationsglab-schedule- Scheduled pipelines and cron jobsglab-variable- CI/CD variables and secretsglab-securefile- Secure files for pipelinesglab-runner-controller- Runner controller and token management (EXPERIMENTAL, admin-only)
Collaboration:
glab-user- User profiles and informationglab-snippet- Code snippets (GitLab gists)glab-incident- Incident management
Advanced:
glab-api- Direct REST API callsglab-cluster- Kubernetes cluster integrationglab-deploy-key- Deploy keys for automationglab-stack- Stacked/dependent merge requestsglab-opentofu- Terraform/OpenTofu state management
Utilities:
glab-alias- Custom command aliasesglab-completion- Shell autocompletionglab-help- Command help and documentationglab-version- Version informationglab-check-update- Update checkerglab-changelog- Changelog generationglab-attestation- Software supply chain securityglab-duo- GitLab Duo AI assistantglab-mcp- Model Context Protocol server for AI assistant integration (EXPERIMENTAL)
When to use glab vs web UI
Use glab when:
- Automating GitLab operations in scripts
- Working in terminal-centric workflows
- Batch operations (multiple MRs/issues)
- Integration with other CLI tools
- CI/CD pipeline workflows
- Faster navigation without browser context switching
Use web UI when:
- Complex diff review with inline comments
- Visual merge conflict resolution
- Configuring repo settings and permissions
- Advanced search/filtering across projects
- Reviewing security scanning results
- Managing group/instance-level settings
Common workflows
Daily development
# Start work on issue
glab issue view 123
git checkout -b 123-feature-name
# Create MR when ready
glab mr create --fill --draft
# Mark ready for review
glab mr update --ready
# Merge after approval
glab mr merge --when-pipeline-succeeds --remove-source-branch
Code review
# List your review queue
glab mr list --reviewer=@me --state=opened
# Review an MR
glab mr checkout 456
glab mr diff
npm test
# Approve
glab mr approve 456
glab mr note 456 -m "LGTM! Nice work on the error handling."
CI/CD debugging
# Check pipeline status
glab ci status
# View failed jobs
glab ci view
# Get job logs
glab ci trace <job-id>
# Retry failed job
glab ci retry <job-id>
Decision Trees
"Should I create an MR or work on an issue first?"
Need to track work?
โโ Yes โ Create issue first (glab issue create)
โ Then: glab mr for <issue-id>
โโ No โ Direct MR (glab mr create --fill)
Use glab issue create + glab mr for when:
- Work needs discussion/approval before coding
- Tracking feature requests or bugs
- Sprint planning and assignment
- Want issue to auto-close when MR merges
Use glab mr create directly when:
- Quick fixes or typos
- Working from existing issue
- Hotfixes or urgent changes
"Which CI command should I use?"
What do you need?
โโ Overall pipeline status โ glab ci status
โโ Visual pipeline view โ glab ci view
โโ Specific job logs โ glab ci trace <job-id>
โโ Download build artifacts โ glab ci artifact <ref> <job-name>
โโ Validate config file โ glab ci lint
โโ Trigger new run โ glab ci run
โโ List all pipelines โ glab ci list
Quick reference:
- Pipeline-level:
glab ci status,glab ci view,glab ci run - Job-level:
glab ci trace,glab job retry,glab job view - Artifacts:
glab ci artifact(by pipeline) or job artifacts viaglab job
"Clone or fork?"
What's your relationship to the repo?
โโ You have write access โ glab repo clone group/project
โโ Contributing to someone else's project:
โ โโ One-time contribution โ glab repo fork + work + MR
โ โโ Ongoing contributions โ glab repo fork, then sync regularly
โโ Just reading/exploring โ glab repo clone (or view --web)
Fork when:
- You don't have write access to the original repo
- Contributing to open source projects
- Experimenting without affecting the original
- Need your own copy for long-term work
Clone when:
- You're a project member with write access
- Working on organization/team repositories
- No need for a personal copy
"Project vs group labels?"
Where should the label live?
โโ Used across multiple projects โ glab label create --group <group>
โโ Specific to one project โ glab label create (in project directory)
Group-level labels:
- Consistent labeling across organization
- Examples: priority::high, type::bug, status::blocked
- Managed centrally, inherited by projects
Project-level labels:
- Project-specific workflows
- Examples: needs-ux-review, deploy-to-staging
- Managed by project maintainers
Related Skills
MR and Issue workflows:
- Start with
glab-issueto create/track work - Use
glab-mrto create MR that closes issue - Script:
scripts/create-mr-from-issue.shautomates this
CI/CD debugging:
- Use
glab-cifor pipeline-level operations - Use
glab-jobfor individual job operations - Script:
scripts/ci-debug.shfor quick failure diagnosis
Repository operations:
- Use
glab-repofor repository management - Use
glab-authfor authentication setup - Script:
scripts/sync-fork.shfor fork synchronization
Configuration:
- Use
glab-authfor initial authentication - Use
glab-configto set defaults and preferences - Use
glab-aliasfor custom shortcuts