| name | gitlab-cli |
| description | GitLab CLI (glab) integration for managing issues, merge requests, branches, commits, and code reviews directly from the terminal. Use when Claude needs to create, list, view, or update GitLab issues; create WIP/draft branches and merge requests; make commits and push changes; review merge request diffs and changes; approve or merge MRs; manage CI/CD pipelines; or work with GitLab repositories without switching to a browser. Requires glab CLI installed and authenticated.
|
GitLab CLI (glab) Skill
Use the glab CLI to interact with GitLab repositories, issues, merge requests, and CI/CD pipelines from the terminal.
Prerequisites
Verify glab is installed and authenticated:
glab --version
glab auth status
If not authenticated, run glab auth login and follow prompts.
Core Workflows
Issue Management
glab issue list
glab issue list --all
glab issue list --assignee=@me
glab issue list --label="bug"
glab issue create -t "Title" -d "Description"
glab issue create -t "Title" --label="bug,priority::high" -m "milestone-1"
glab issue create
glab issue view 123
glab issue view 123 --web
glab issue update 123 --label="in-progress"
glab issue close 123
glab issue reopen 123
glab issue note 123 -m "Working on this now"
Branch & Commit Workflow
git checkout -b feature/my-feature
git checkout -b fix/issue-123
git checkout -b draft/wip-experiment
git add .
git commit -m "feat: add new feature"
git commit -m "fix: resolve issue #123"
git push -u origin feature/my-feature
Merge Request Management
glab mr create
glab mr create --fill
glab mr create --draft
glab mr create --draft --fill
glab mr create -t "Title" -d "Description" -b main
glab mr create --label="review-needed" --assignee=@me
glab mr for 123
glab mr list
glab mr list --assignee=@me
glab mr list --reviewer=@me
glab mr list --draft
glab mr view 45
glab mr view 45 --web
Code Review Workflow
glab mr checkout 45
glab mr diff 45
glab mr diff
glab mr note 45 -m "LGTM, minor suggestion on line 42"
glab mr note -m "Please add tests"
glab mr approve 45
glab mr merge 45
glab mr merge 45 --squash
glab mr merge 45 --rebase
glab mr merge 45 --yes
glab mr revoke 45
Update Existing MR
glab mr update 45 --title "New title"
glab mr update 45 --description "Updated description"
glab mr update 45 --target-branch develop
glab mr update 45 --label "ready-for-review"
glab mr update 45 --draft=false
glab mr update
CI/CD Pipeline Management
glab ci list
glab ci view
glab ci status
glab ci run
glab ci run -b main
glab ci retry
glab ci trace
glab ci trace 12345
glab ci lint
Common Flag Reference
| Flag | Description |
|---|
-R, --repo OWNER/REPO | Target different repository |
-b, --target-branch | Target branch for MR |
-s, --source-branch | Source branch for MR |
-t, --title | Title for issue/MR |
-d, --description | Description for issue/MR |
-l, --label | Labels (comma-separated) |
-a, --assignee | Assignee username |
-m, --milestone | Milestone name |
--draft | Create as draft MR |
--fill | Auto-fill from commit messages |
--web | Open in browser |
-y, --yes | Skip confirmation prompts |
Environment Variables
export GITLAB_TOKEN="glpat-xxxx"
export GITLAB_HOST="https://gitlab.example.com"
Tips & Gotchas
Multi-line Descriptions with Markdown
When updating issues or MRs with long descriptions containing markdown (code blocks, backticks), avoid heredocs which can fail due to shell interpretation. Instead:
glab issue update 123 --description "$(cat temp_description.txt)"
rm temp_description.txt
This avoids issues with:
- Backticks in code blocks conflicting with command substitution
- Special characters being interpreted by the shell
- Heredoc delimiter conflicts
Sourcing Description from Existing Files
To update an issue from a markdown plan file:
cat docs/plans/my-plan.md | tail -n +7 > temp_desc.txt
glab issue update 123 --description "$(cat temp_desc.txt)"
rm temp_desc.txt
Detailed Reference
For comprehensive command options and examples, see references/commands.md.