### Guided Onboarding for GitLab Knowledge Graph Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/orbit/_index.md Use this command for guided onboarding to verify access, install the necessary skill, and set up the local CLI for the Orbit feature. ```console # Guided onboarding: verify access, install the skill, install the local CLI $ glab orbit setup ``` -------------------------------- ### Start Interactive Login Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/auth/login.md Initiates an interactive setup process. If run within a Git repository, glab will attempt to detect and suggest GitLab instances from your remotes. ```console glab auth login ``` -------------------------------- ### Interactive Orbit Setup Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/orbit/setup.md Run the interactive setup process, which prompts for confirmation at each step. ```console glab orbit setup ``` -------------------------------- ### Example `glab stack reorder` Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/stack/reorder.md An example of how to use the `glab stack reorder` command. ```console glab stack reorder ``` -------------------------------- ### Install glab binary to GOPATH/bin Source: https://gitlab.com/gitlab-org/cli/-/blob/main/README.md Install the built GitLab CLI binary to your Go binary directory. ```bash make install ``` -------------------------------- ### Example Usage of `glab stack list` Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/stack/list.md This is an example of how to use the `glab stack list` command to display all entries in the stack. ```console glab stack list ``` -------------------------------- ### Install edge glab with Snapcraft Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/installation_options.md Install the latest edge release of the GitLab CLI (updated on every commit to main) using Snapcraft. Ensure snap is installed. ```shell sudo snap install --edge glab ``` -------------------------------- ### Search Examples Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/repo/search.md These examples demonstrate how to use the `glab repo search` command and its aliases with the search flag to find projects containing a specific string in their name. ```console glab project search -s "title" glab repo search -s "title" glab project find -s "title" glab project lookup -s "title" ``` -------------------------------- ### GitLab CLI Command Grammar Examples Source: https://gitlab.com/gitlab-org/cli/-/blob/main/CONTRIBUTING.md Illustrates the noun-first, verb-second grammatical structure used in GitLab CLI commands, with examples for common verbs like create, list, get, update, and delete. ```markdown - `create` - Used when creating a singular object. For example, `glab mr create` creates a new merge request. - `list` - Used by commands that output more than one object at a time. For example, `glab ci list` returns a list of all running pipelines. - `get` - Used by commands that output a singular object at a time. For example, `glab ci get --pipeline-id 1` returns the pipeline with the specified ID. - `update` - Used by commands that update one object at a time. For example, `glab mr update 1 --title "new title"` updates the title of the merge request with ID `1`. - `delete` - Used when deleting one or more objects at time. For example, `glab ci delete 1,2,3` deletes the pipelines with IDs `1`, `2`, and `3`. ``` -------------------------------- ### Install glab with WinGet on Windows Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/installation_options.md Install the GitLab CLI using the Windows Package Manager (WinGet). ```shell winget install glab.glab ``` -------------------------------- ### Install glab with Scoop on Windows Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/installation_options.md Install the GitLab CLI using the Scoop package manager on Windows. ```shell scoop install glab ``` -------------------------------- ### Install Duo CLI Binary Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/duo/cli.md Install the Duo CLI binary without immediately running it. ```console glab duo cli --install ``` -------------------------------- ### Example: Show Files Changed in Last Commit Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/duo/ask.md Use `glab duo ask` to get Git commands for specific operations. This example shows how to ask for commands to display files changed in the last commit. ```console # Explain how to display files changed in the last commit glab duo ask show me files changed in the last commit ``` -------------------------------- ### Install Development Tools with Mise Source: https://gitlab.com/gitlab-org/cli/-/blob/main/CONTRIBUTING.md Installs all necessary development tools, including linters and formatters, using mise. Enables git hooks after installation. ```bash # Install mise if you don't have it curl https://mise.run | sh # Install all development tools (includes lefthook) make bootstrap # Enable git hooks lefthook install ``` -------------------------------- ### Install latest stable glab with Snapcraft Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/installation_options.md Install the latest stable release of the GitLab CLI using Snapcraft. Ensure snap is installed on your Linux distribution. ```shell sudo snap install glab ``` -------------------------------- ### Example: Undo Last Commit Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/duo/ask.md Use `glab duo ask` to get Git commands for specific operations. This example shows how to ask for commands to undo the last commit. ```console # Explain how to undo the last commit glab duo ask how do I undo my last commit ``` -------------------------------- ### Install glab with Homebrew Source: https://gitlab.com/gitlab-org/cli/-/blob/main/README.md Use this command to install the GitLab CLI using the Homebrew package manager. ```bash brew install glab ``` -------------------------------- ### Install Duo CLI Binary Without Prompts Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/duo/cli.md Install the Duo CLI binary non-interactively, skipping any confirmation prompts. ```console glab duo cli --install --yes ``` -------------------------------- ### Install Orbit local CLI binary without prompts Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/orbit/local.md Installs the Orbit local CLI binary without any confirmation prompts. This is the non-interactive way to install the binary. ```bash glab orbit local --install --yes ``` -------------------------------- ### Install Skill to Custom Directory Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/skills/install.md Installs a specified skill, like `glab-stack`, to a custom directory. The path is resolved relative to the current working directory. ```console glab skills install glab-stack --path /path/to/skills ``` -------------------------------- ### Non-interactive Orbit Setup Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/orbit/setup.md Accept all prompts automatically to complete the setup without user interaction. ```console glab orbit setup --yes ``` -------------------------------- ### Install glab with Chocolatey on Windows Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/installation_options.md Install the GitLab CLI using the Chocolatey package manager on Windows. ```shell choco install glab ``` -------------------------------- ### Install Glab on Debian/Ubuntu via WakeMeOps Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/installation_options.md Installs glab on Debian or Ubuntu systems by first adding the WakeMeOps repository and then installing the glab package. ```shell # Add WakeMeOps repository curl -sSL "https://raw.githubusercontent.com/upciti/wakemeops/main/assets/install_repository" | sudo bash # Install glab sudo apt install glab ``` -------------------------------- ### Core Stack Workflow Example Source: https://gitlab.com/gitlab-org/cli/-/blob/main/internal/commands/skills/bundled/assets/glab-stack/SKILL.md Demonstrates the typical workflow for creating a feature stack, saving incremental changes, and syncing them to GitLab. ```bash # 1. Create a stack for a feature glab stack create add-authentication # 2. Build the first layer (data model) git add app/models/user.rb db/migrate/001_create_users.rb glab stack save -m "Add user model and migration" # 3. Build the second layer (API) — depends on the model above git add app/controllers/sessions_controller.rb glab stack save -m "Add session controller" # 4. Build the third layer (UI) — depends on the API above glab stack save . -m "Add login view and assets" # 5. Push all branches and open MRs on GitLab glab stack sync ``` -------------------------------- ### Show Common Resources Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/cluster/graph.md This example demonstrates how to show common resources from both the core and RBAC groups. ```console # Show common resources from the core and RBAC groups glab cluster graph -R user/project -a 123 --core --rbac ``` -------------------------------- ### Serve MCP Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/mcp/_index.md Starts the Model Context Protocol server. This command is experimental and may be unstable or removed in the future. ```console glab mcp serve ``` -------------------------------- ### Install glab with Homebrew on macOS Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/installation_options.md Use this command to install the GitLab CLI via Homebrew on macOS. Ensure Homebrew is installed first. ```shell brew install glab ``` -------------------------------- ### Example: List Last 10 Commit Titles Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/duo/ask.md Use `glab duo ask` to get Git commands for specific operations. This example shows how to ask for commands to display the titles of the last 10 commits. ```console # Explain how to display the titles of the last 10 commits glab duo ask how to list last 10 commit titles ``` -------------------------------- ### Install Core Skill Globally Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/skills/install.md Installs the core `glab` skill for the current user in the `~/.agents/skills/` directory. This makes the skill available across all projects for the user. ```console glab skills install --global ``` -------------------------------- ### Install glab with ASDF on macOS Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/installation_options.md Install the GitLab CLI using the ASDF version manager. This involves adding the plugin, installing the latest version, and setting it globally. ```shell asdf plugin add glab; asdf install glab latest; asdf global glab latest ``` -------------------------------- ### Install Core Glab Skill Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/skills/install.md Installs the default core `glab` skill into the current project's `.agents/skills/` directory. This is the default behavior when no specific skill name is provided. ```console glab skills install ``` -------------------------------- ### Verify glab installation Source: https://gitlab.com/gitlab-org/cli/-/blob/main/README.md Confirm that the GitLab CLI has been installed correctly by checking its version. ```bash glab version ``` -------------------------------- ### Create a runner controller with default settings Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/runner-controller/create.md Use this command to create a runner controller with all default settings. This is useful for initial setup or testing. ```bash glab runner-controller create ``` -------------------------------- ### Install glab with apk on Alpine Linux Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/installation_options.md Install the GitLab CLI using the apk package manager on Alpine Linux. Use `--no-cache` to avoid requiring an `apk update`. ```shell apk add --no-cache glab ``` -------------------------------- ### Install Fish Completions for Every Session Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/completion/_index.md To load Fish completions for every new session, redirect the output of `glab completion -s fish` to `~/.config/fish/completions/glab.fish`. ```shell glab completion -s fish > ~/.config/fish/completions/glab.fish ``` -------------------------------- ### Example usage of glab orbit remote tools Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/orbit/remote/tools.md This example demonstrates how to execute the `glab orbit remote tools` command without any additional flags. It will output the MCP tool manifest in JSON format. ```console $ glab orbit remote tools ``` -------------------------------- ### Install glab with pacman on Arch Linux Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/installation_options.md Install the GitLab CLI using the pacman package manager on Arch Linux. This assumes the 'glab' package is available in the repositories. ```shell pacman -S glab ``` -------------------------------- ### Global Orbit Skill Installation Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/orbit/setup.md Install the Orbit skill at the user scope (~/.agents/skills/) instead of the current repository. ```console glab orbit setup --global ``` -------------------------------- ### Install Specific Bundled Skill Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/skills/install.md Installs a specific bundled skill, such as `glab-stack`, by its name. Use `glab skills list` to see available skills. ```console glab skills install glab-stack ``` -------------------------------- ### Install VHS Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/demos/README.md Installs VHS using Homebrew on macOS. For other platforms, refer to the official VHS installation guide. ```shell # macOS brew install vhs # Other platforms: https://github.com/charmbracelet/vhs#installation ``` -------------------------------- ### Install Orbit local CLI binary Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/orbit/local.md Installs the Orbit local CLI binary without executing it. This is useful if you only want to prepare the binary for later use. ```bash glab orbit local --install ``` -------------------------------- ### CI/CD Manual Login Setup Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/auth/login.md Provides a manual login method for CI/CD environments when auto-login is not suitable or when a personal access token is required. It specifies the GitLab instance hostname, job token, and API protocol. ```console glab auth login --hostname $CI_SERVER_FQDN --job-token $CI_JOB_TOKEN --api-protocol $CI_SERVER_PROTOCOL ``` -------------------------------- ### GitLab CLI Development Workspace Setup Source: https://gitlab.com/gitlab-org/cli/-/blob/main/CONTRIBUTING.md Commands to build, run, test, and lint the GitLab CLI within a development workspace. ```bash # Build the CLI binary make # Run the CLI ./bin/glab # Run unit tests make test # Format and lint code make lint ``` -------------------------------- ### Add a remote repository with a custom name Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/repo/remote/add.md This example demonstrates how to specify a custom name for the remote repository using the `--name` flag. ```console glab repo remote add alice/my-project --name upstream ``` -------------------------------- ### Conventional Commit Structure Example Source: https://gitlab.com/gitlab-org/cli/-/blob/main/CONTRIBUTING.md Illustrates the standard format for commit messages, including type, scope, description, body, and footer for referencing issues. ```shell feat(kafka): implement exactly once delivery - ensure every event published to kafka is delivered exactly once - implement error handling for failed delivery Delivers #065 ``` ```shell fix(login): allow provided user preferences to override default preferences - This allows the preferences associated with a user account to override and customize the default app preferences like theme or timezone. Fixes #025 ``` -------------------------------- ### Example usage of glab orbit remote dsl Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/orbit/remote/dsl.md Demonstrates the basic usage of the `glab orbit remote dsl` command without any flags. ```console $ glab orbit remote dsl ``` -------------------------------- ### Create a Release Using Notes from a File Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/release/create.md Populate release notes by referencing a file using the `-F` or `--notes-file` flag. ```console glab release create v1.0.1 -F changelog.md ``` -------------------------------- ### Get Secure File Details Using Alias Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/securefile/get.md Demonstrates using the 'show' alias to retrieve secure file details by ID. ```console glab securefile show 1 ``` -------------------------------- ### Install Glab from Edge on Alpine Linux Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/installation_options.md Add the edge repository to Alpine Linux and install glab using apk. The --no-cache flag prevents the need for an apk update. ```shell echo "@edge http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories apk add --no-cache glab@edge ``` -------------------------------- ### Retrieve Stored Credentials for a Registry Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/auth/docker-helper.md Docker invokes the helper automatically. This example shows how to retrieve stored credentials for a registry using the 'get' action. ```console echo registry.gitlab.com | glab auth docker-helper get ``` -------------------------------- ### Install Zsh Completions for Older macOS Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/completion/_index.md For older versions of macOS, you might need to redirect the output of `glab completion -s zsh` to `/usr/local/share/zsh/site-functions/_glab` to install completions. ```shell glab completion -s zsh > /usr/local/share/zsh/site-functions/_glab ``` -------------------------------- ### Install glab with MacPorts on macOS Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/installation_options.md Install the GitLab CLI using MacPorts on macOS. This requires MacPorts to be installed. ```shell sudo port install glab ``` -------------------------------- ### Show Duo CLI Help Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/duo/cli.md Access the specific help documentation for the Duo CLI binary. ```console glab duo cli help ``` -------------------------------- ### List All Project Issues Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/issue/list.md Use the `--all` flag to retrieve all issues, regardless of their state. This command is useful for getting a comprehensive overview of all issues within a project. ```console glab issue list --all ``` ```console glab issue ls --all ``` -------------------------------- ### Create and Sync Stacked Diffs Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/stack/_index.md Examples of creating a new stacked diff and synchronizing existing ones. ```console glab stack create cool-new-feature ``` ```console glab stack sync ``` -------------------------------- ### Install Bash Completions for Linux Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/completion/_index.md To load Bash completions for every new session on Linux, redirect the output of `glab completion -s bash` to `/etc/bash_completion.d/glab`. ```shell glab completion -s bash > /etc/bash_completion.d/glab ``` -------------------------------- ### Make a GET request to a REST API endpoint Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/api/_index.md Use `glab api` with an endpoint to make a GET request. The default method is GET if no parameters are provided. ```plaintext glab api projects/:id/repository/branches ``` -------------------------------- ### Add a New Tape Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/demos/README.md Steps to create a new tape file, copy from a reference example, update output paths and scripts, and generate the GIF. ```shell vhs .tape ``` -------------------------------- ### List Deploy Keys with IDs Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/deploy-key/list.md Includes the key ID in the output, which can be used with `get` and `delete` commands. This is useful for managing specific deploy keys. ```console glab deploy-key list --show-id ``` -------------------------------- ### Manage Variables Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/schedule/update.md This example demonstrates how to add, update, and delete variables for a pipeline schedule in a single command. Variables are passed as key:value pairs for creation/update and as keys for deletion. ```console glab schedule update 10 --create-variable "foo:bar" --update-variable "baz:qux" --delete-variable "old" ``` -------------------------------- ### Create Project and Configure Pull Mirroring Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/repo/mirror.md This snippet demonstrates how to create a new public project and then configure pull mirroring for it from an external repository. ```console glab repo create mygroup/myproject --public glab repo mirror mygroup/myproject --direction=pull --url="https://gitlab.example.com/org/repo" ``` -------------------------------- ### Compute SHA256 Checksum for WinGet Installer Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/release_process.md This command calculates the SHA256 checksum for a downloaded Windows installer package. Replace 'filename.exe' with the actual name of the installer file. ```shell $ sha256sum glab_1.23.1_Windows_x86_64_installer.exe 36f9d45f68ea53cbafdbe96ba4206e4412abb4c2b8f00ba667054523bd7cc89e glab_1.23.1_Windows_x86_64_installer.exe ``` -------------------------------- ### Show glab version Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/version/_index.md Prints the installed glab version and the commit it was built from. Include this information when reporting a bug. ```plaintext glab version [flags] ``` -------------------------------- ### Build the GitLab CLI Project Source: https://gitlab.com/gitlab-org/cli/-/blob/main/CONTRIBUTING.md Use `make` for a streamlined build process or `go build` for direct compilation. The built binary will be available in the `bin/` directory. ```bash make ``` ```bash go build -o bin/glab ./cmd/glab/main.go ``` -------------------------------- ### List current project access tokens Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/token/list.md Lists access tokens for the current project. Use `--output json` to get the output in JSON format. ```console glab token list ``` ```console glab token list --output json ``` -------------------------------- ### Create a Release with Notes Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/release/create.md Create a release non-interactively by providing release notes directly via the `--notes` flag. ```console glab release create v1.0.1 --notes "bugfix release" ``` -------------------------------- ### List, Create, View, and Note Issues Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/issue/_index.md Demonstrates common `glab issue` commands for listing, creating, viewing, and adding notes to issues. Use `--repo` to target a project other than the current one. ```console glab issue list glab issue create --label --confidential glab issue view --web 123 glab issue note -m "closing because !123 was merged" ``` -------------------------------- ### Install Bash Completions for macOS Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/completion/_index.md To load Bash completions for every new session on macOS, redirect the output of `glab completion -s bash` to `/usr/local/etc/bash_completion.d/glab`. ```shell glab completion -s bash > /usr/local/etc/bash_completion.d/glab ``` -------------------------------- ### CI/CD Auto-Login Setup Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/auth/login.md Enables CI auto-login for glab commands. In most cases, this is the preferred method for CI/CD environments as it leverages CI job tokens automatically. ```console GLAB_ENABLE_CI_AUTOLOGIN=true glab release list -R $CI_PROJECT_PATH ``` -------------------------------- ### List All Repositories on Instance Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/repo/list.md Lists every project on the instance, removing the ownership filter. Results are paginated. ```plaintext glab repo list --all ``` -------------------------------- ### Show Help for `glab repo list` Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/repo/list.md Displays help information for the `glab repo list` command. ```plaintext glab repo list --help ``` -------------------------------- ### Run GitLab Duo CLI Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/duo/cli.md Execute the main GitLab Duo CLI command to start an interactive session or pass commands. ```console glab duo cli ``` -------------------------------- ### Run the GitLab CLI Binary Source: https://gitlab.com/gitlab-org/cli/-/blob/main/CONTRIBUTING.md After building the project, execute the `glab` binary from the `./bin/` directory to use the CLI. ```bash ./bin/glab ``` -------------------------------- ### List all packages in the current project Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/packages/list.md Use this command to list all available packages within the current project's registry. This includes all package types. ```console glab packages list ``` -------------------------------- ### Install Zsh Completions for Linux Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/completion/_index.md To load Zsh completions for every new session on Linux, redirect the output of `glab completion -s zsh` to a file in your `$fpath`. ```shell glab completion -s zsh > "${fpath[1]}/_glab" ``` -------------------------------- ### List Deploy Keys Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/deploy-key/list.md Lists the deploy keys for the current project. This is the default behavior of the command. ```console glab deploy-key list ``` -------------------------------- ### Show Indexing Progress with Compact Output for Agents Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/orbit/remote/graph-status.md Use the `--format llm` flag to get compact output suitable for agents when looking up indexing progress. ```bash glab orbit remote graph-status --full-path gitlab-org/gitlab --format llm ``` -------------------------------- ### List Repositories Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/repo/list.md Lists the projects you own. Use flags like `--all`, `--group`, or `--user` to modify the scope. ```plaintext glab repo list ``` -------------------------------- ### Merge Request Merge Examples Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/mr/merge.md Examples of merging a merge request by ID or accepting the merge request from the current branch. ```console # Merge a merge request glab mr merge 235 glab mr accept 235 # Finds open merge request from current branch glab mr merge ``` -------------------------------- ### Get Orbit DSL Schema Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/orbit/remote/_index.md Use `glab orbit remote dsl` to get the full query DSL JSON Schema. ```shell glab orbit remote dsl ``` -------------------------------- ### Build the glab binary from source Source: https://gitlab.com/gitlab-org/cli/-/blob/main/README.md Compile the GitLab CLI from source code using the 'make build' command. ```bash make build ``` -------------------------------- ### Change a label's color and description in another project Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/label/edit.md This example shows how to update a label's color and description in a different repository by specifying the target repository with the `-R` flag. ```console glab label edit --label-id 1234 --color "#FF0000" --description "Top priority" -R owner/repo ``` -------------------------------- ### Initialize OpenTofu State with Reconfiguration Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/opentofu/init.md Initializes OpenTofu state with the name 'production' and reconfigures the state. ```bash glab opentofu init production -- -reconfigure ``` -------------------------------- ### Check for and install Orbit CLI updates Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/orbit/local.md Checks if a newer version of the Orbit local CLI binary is available and installs it if found. This ensures you are using the latest version. ```bash glab orbit local --update ``` -------------------------------- ### Install Glab using Alpine Linux Docker Image Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/installation_options.md Use the official Alpine Linux Docker image to install glab. This method is suitable for containerized environments. ```dockerfile FROM alpine:3.13 RUN apk add --no-cache glab ``` -------------------------------- ### Bootstrap Agent with Custom Environment Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/cluster/agent/bootstrap.md Bootstrap an agent and configure an environment with a custom name and Kubernetes namespace. ```console # Bootstrap "my-agent" and configure an environment with custom name and Kubernetes namespace glab cluster agent bootstrap my-agent --environment-name production --environment-namespace default ``` -------------------------------- ### Log in to staging.gitlab.com with `glab` Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/testing_against_staging.md Use this command to initiate an interactive login to the staging environment. You will be prompted for your personal access token and other settings. ```shell glab auth login --hostname staging.gitlab.com ``` -------------------------------- ### Get Label Info from Another Project Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/label/get.md To get information about a label in a different project, specify the project using the `-R` or `--repo` flag with the owner/repo format. ```bash glab label get 1234 -R owner/repo ``` -------------------------------- ### Example Slack Release Notification Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/slack_notifications.md An example of the automated Slack notification sent upon a new release, including version, changelog, commit details, and download links. ```plaintext 🚀 glab v1.35.0 has been released! What's Changed Features • Add support for stacked diffs - a1b2c3d4 by Kai Armstrong • Implement MCP server for AI assistants - e5f6g7h8 by Shekhar Patnaik Bug Fixes • Fix pipeline status display - i9j0k1l2 by Timo Furrer • Resolve authentication issue with tokens - m3n4o5p6 by Kai Armstrong Documentation • Update installation instructions - q7r8s9t0 by Achilleas Pipinellis Maintenance • Refactor make bootstrap to separate script - c9d0e1f2 by Kai Armstrong Dependencies • Update module github.com/mark3labs/mcp-go to v0.43.1 - u1v2w3x4 by GitLab Renovate Bot • Update module golang.org/x/crypto to v0.45.0 - y5z6a7b8 by GitLab Renovate Bot Get the Release • View on GitLab • Download Assets ``` -------------------------------- ### Update All Installed Skills Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/skills/update.md Updates every installed skill in all known locations. This command fetches the latest versions from the source and overwrites local copies if they have changed. Use this to ensure all skills are up-to-date. ```plaintext glab skills update --all ``` -------------------------------- ### Create a Release Interactively Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/release/create.md Use this command to create a new release interactively, prompting for necessary details. ```console glab release create v1.0.1 ``` -------------------------------- ### Create a runner controller with a description Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/runner-controller/create.md This command creates a runner controller and assigns a specific description to it. Use this to identify the controller's purpose. ```bash glab runner-controller create --description "My controller" ``` -------------------------------- ### Infer stack from commits on a feature branch since it diverged from develop Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/stack/infer.md Use this to infer a stack from commits on a feature branch, starting from where it diverged from the 'develop' branch. The start of the range must be a branch name. ```console glab stack infer develop..HEAD ``` -------------------------------- ### Run `glab stack first` Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/stack/first.md Use this command to move to the first diff in your current stack. This is an experimental feature. ```bash glab stack first ``` -------------------------------- ### Get editor configuration Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/config/get.md Retrieves the configured editor from the configuration settings. ```plaintext $ glab config get editor vim ``` -------------------------------- ### Create Repository (Current Directory Name) Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/repo/create.md Use this to create a repository named after the current directory under your personal namespace. No additional flags are needed. ```bash glab repo create ``` -------------------------------- ### Get a group variable Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/variable/get.md Prints the value of a single variable by key for a specific group. ```console glab variable get -g GROUP VAR_KEY ``` -------------------------------- ### Get a project variable Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/variable/get.md Prints the value of a single variable by key for the current project. ```console glab variable get VAR_KEY ``` -------------------------------- ### Get glamour style configuration Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/config/get.md Retrieves the configured glamour style from the configuration settings. ```plaintext $ glab config get glamour_style notty ``` -------------------------------- ### Get Runner Controller by ID Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/runner-controller/get.md Retrieves details of a specific runner controller using its ID. ```console glab runner-controller get 42 ``` -------------------------------- ### Get Group Milestone Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/milestone/get.md Retrieves a specific milestone from a group by providing the group's identifier. ```plaintext glab milestone get 123 --group example-group ``` -------------------------------- ### Run Local Orbit CLI Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/orbit/_index.md Execute the Orbit local CLI binary. The binary will be downloaded automatically on its first use. ```console # Run the Orbit local CLI (downloads the binary on first use) $ glab orbit local ``` -------------------------------- ### List repositories for the current project Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/container-registry/repository/list.md Use this command to list container registry repositories for the project you are currently in. ```bash glab container-registry repository list ``` -------------------------------- ### Get Milestone by ID Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/milestone/get.md Retrieves a specific milestone from the current project using its numeric ID. ```plaintext glab milestone get 123 ``` -------------------------------- ### Get Pipeline Status for a Specific Branch Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/ci/status.md Retrieve the pipeline status for a specified branch, such as 'main'. ```console glab ci status --branch=main ``` -------------------------------- ### Show Specific Resources Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/cluster/graph.md Use the --resource flag to specify particular resource types to watch. ```console # Show certain resources glab cluster graph -R user/project -a 123 --resource=pods --resource=configmaps ``` -------------------------------- ### List all secure files in the current project Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/securefile/list.md Use this command to list all secure files configured for the current project. No additional flags are required for basic listing. ```console glab securefile list ``` -------------------------------- ### Show Help for Duo CLI Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/duo/cli.md Display the help information for the GitLab Duo CLI. ```console glab duo cli --help ``` -------------------------------- ### Delete CI/CD Pipelines by Status Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/ci/delete.md This command deletes all pipelines that have a specific status, for example, 'failed'. ```bash glab ci delete --status=failed ``` -------------------------------- ### Update Duo CLI Binary Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/duo/cli.md Check for and install the latest available updates for the Duo CLI binary. ```console glab duo cli --update ``` -------------------------------- ### Configure Push Mirroring with Divergent Refs Allowed Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/repo/mirror.md Use this command to set up push mirroring and allow synchronization even when the source and target repositories have diverged. This can be useful for complex workflows but should be used with caution. ```console glab repo mirror mygroup/myproject --direction=push --url="https://gitlab-backup.example.com/backup/repo" --allow-divergence ``` -------------------------------- ### Get Runner Controller as JSON Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/runner-controller/get.md Retrieves details of a specific runner controller and formats the output as JSON. ```console glab runner-controller get 42 --output json ``` -------------------------------- ### Get Milestone as JSON Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/milestone/get.md Retrieves a specific milestone and formats the output as JSON, suitable for programmatic use. ```plaintext glab milestone get 123 --output json ``` -------------------------------- ### List all instance runners Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/runner/list.md To list all runners available at the instance level, use the `--instance` flag. This requires administrator access. ```console glab runner list -i ``` -------------------------------- ### Verify Orbit Reachability Only Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/orbit/setup.md Skip the agent-skill and local CLI binary installation steps, performing only the reachability check. ```console glab orbit setup --skip-skill --skip-local ``` -------------------------------- ### Get Secure File Details by ID Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/securefile/get.md Retrieves the details of a secure file using its ID in the current project. ```console glab securefile get 1 ``` -------------------------------- ### Get Orbit Tool Manifest Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/orbit/remote/_index.md Use `glab orbit remote tools` to view the MCP tool manifest. ```shell glab orbit remote tools ``` -------------------------------- ### Synopsis of `glab stack first` Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/stack/first.md This is the basic command structure for `glab stack first`. Flags can be added for further options. ```plaintext glab stack first [flags] ``` -------------------------------- ### Get a token for an agent Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/cluster/agent/get-token.md Use this command to retrieve a token for a specific agent. The agent is identified by its numerical ID. ```console glab cluster agent get-token --agent 123 ``` -------------------------------- ### Create Repository with Specific Name Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/repo/create.md Provide a specific name for the new repository. This command creates a repository named 'my-project' under your personal namespace. ```bash glab repo create my-project ``` -------------------------------- ### Get Pipeline Status for the Current Branch Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/ci/status.md View the pipeline status for the currently checked-out branch. This is the default behavior. ```console glab ci status ``` -------------------------------- ### Show Specific Resources (Compact) Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/cluster/graph.md This is a more compact way to specify multiple resources using the -r flag with a comma-separated list. ```console # Same as above, but more compact glab cluster graph -R user/project -a 123 -r={pods,configmaps} ``` -------------------------------- ### Compact CI/CD Pipeline Status View Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/ci/status.md Get a more compact view of the pipeline status. This is useful for a quick overview. ```console glab ci status --compact ``` -------------------------------- ### Search for authentication-related code Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/search/semantic.md Searches for code related to 'authentication middleware' in the current project. This is a basic usage example. ```console glab search semantic -q "authentication middleware" ``` -------------------------------- ### List Releases for a Project Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/api/_index.md Lists releases for the current project. The `:fullpath` placeholder will be expanded automatically. ```console # List releases for the current project, expanding the :fullpath placeholder glab api projects/:fullpath/releases ``` -------------------------------- ### Get CI/CD details for a merge request Source: https://gitlab.com/gitlab-org/cli/-/blob/main/internal/commands/skills/bundled/assets/glab/SKILL.md Retrieve CI/CD details for a specific merge request, including job details. ```shell glab ci get --merge-request --with-job-details ``` -------------------------------- ### Set a project variable from standard input Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/variable/set.md This command demonstrates setting a variable by piping its content from standard input. ```console cat file.txt | glab variable set SERVER_TOKEN ``` -------------------------------- ### Get Milestone from Different Project Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/milestone/get.md Retrieves a specific milestone from a different project by providing the project's owner and name. ```plaintext glab milestone get 123 --project owner/project ``` -------------------------------- ### Get CI/CD details for a pipeline in JSON format Source: https://gitlab.com/gitlab-org/cli/-/blob/main/internal/commands/skills/bundled/assets/glab/SKILL.md Retrieve CI/CD details for a specific pipeline ID and output in JSON format. ```shell glab ci get --pipeline-id --output json ``` -------------------------------- ### Select another repository Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/cluster/agent/token-cache/_index.md Use this option to specify a different repository for the command. Accepts OWNER/REPO, GROUP/NAMESPACE/REPO, or full/Git URLs. ```plaintext -R, --repo string Select another repository. You can use either OWNER/REPO or GROUP/NAMESPACE/REPO. The full URL or Git URL is also accepted. ``` -------------------------------- ### Get CI/CD pipeline status in JSON format Source: https://gitlab.com/gitlab-org/cli/-/blob/main/internal/commands/skills/bundled/assets/glab/SKILL.md Retrieve the CI/CD pipeline status and output it in JSON format for machine parsing. ```shell glab ci status --output json ``` -------------------------------- ### Run the Orbit local CLI Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/orbit/local.md This is the basic command to run the Orbit local CLI. It will download and verify the binary if it's not already present. ```bash glab orbit local ``` -------------------------------- ### Initialize OpenTofu State Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/opentofu/init.md Initializes OpenTofu state with the name 'production' in the current working directory. ```bash glab opentofu init production ``` -------------------------------- ### Select Specific Namespaces Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/cluster/graph.md Use the -n flag to specify a comma-separated list of namespaces to watch. ```console # Select a certain namespace glab cluster graph -R user/project -a 123 -n={my-ns,my-stuff} ``` -------------------------------- ### View Project Information by Name Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/repo/view.md Specify the project name to view its details. This can be in the format 'user/repo', 'group/namespace/repo', or a full Git URL. ```console # glab repo view my-project glab repo view user/repo glab repo view group/namespace/repo ``` ```console glab repo view git@gitlab.com:user/repo.git glab repo view https://gitlab.company.org/user/repo glab repo view https://gitlab.company.org/user/repo.git ``` -------------------------------- ### Grant SSH keys access to Snapcraft glab Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/installation_options.md Connect the Snapcraft installation of glab to your SSH keys to allow it to access Git repositories. ```shell sudo snap connect glab:ssh-keys ``` -------------------------------- ### List instance variables Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/variable/list.md To list CI/CD variables at the instance level, use the `-i` or `--instance` flag. This retrieves variables applicable to all projects and groups. ```console glab variable list -i ``` -------------------------------- ### Get a project variable for a specific scope Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/variable/get.md Prints the value of a single variable by key for a specific environment scope within the current project. ```console glab variable get -s SCOPE VAR_KEY ``` -------------------------------- ### Get Secure File Details from Another Project Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/securefile/get.md Retrieves secure file details from a different project by specifying the repository owner and name. ```console glab securefile get 1 -R owner/repo ``` -------------------------------- ### Basic glab Command Structure Source: https://gitlab.com/gitlab-org/cli/-/blob/main/README.md Illustrates the general pattern for executing glab commands, including commands, subcommands, and flags. ```shell glab [flags] ``` -------------------------------- ### List managers as JSON Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/runner/managers.md To get the output in JSON format, use the `--output json` flag. This is useful for programmatic parsing of the results. ```console glab runner managers 1 --output json ``` -------------------------------- ### List GPG Keys Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/gpg-key/list.md Use this command to list all GPG keys for the authenticated user. The output includes the key and its creation date. ```console glab gpg-key list ``` -------------------------------- ### Get Label Info by ID Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/label/get.md Use this command to retrieve information about a specific label within the current project, identified by its numeric ID. ```bash glab label get 1234 ``` -------------------------------- ### Open Configuration with Default Editor Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/config/edit.md Opens the glab configuration file using the system's default editor. ```console glab config edit ``` -------------------------------- ### Add glab to PATH if not already present Source: https://gitlab.com/gitlab-org/cli/-/blob/main/README.md Optionally add the local 'bin' directory to your system's PATH if GOPATH/bin or GOBIN are not configured. ```bash export PATH=$PWD/bin:$PATH ``` -------------------------------- ### Go to the Oldest Diff Source: https://gitlab.com/gitlab-org/cli/-/blob/main/internal/commands/skills/bundled/assets/glab-stack/SKILL.md Navigates the working directory to the oldest diff (commit) in the current stack. This is useful for starting work from the foundation of the stack. ```bash glab stack first ``` -------------------------------- ### List container registry repositories Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/container-registry/_index.md Lists container registry repositories for the current project. Use this command to view available image repositories. ```console # List container registry repositories for the current project glab container-registry repository list ``` -------------------------------- ### Configure glab with mise-en-place on macOS Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/installation_options.md Add this configuration to your mise.toml or other mise configuration file to manage the GitLab CLI version. Then run `mise install`. ```toml "ubi:gitlab-org/cli" = { version = "latest", exe = "glab", provider = "gitlab" } ``` -------------------------------- ### Configure Pull Mirroring from Private Repository Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/repo/mirror.md Use this command to set up pull mirroring from a private external repository. Embed your username and access token directly in the URL for authentication. ```console glab repo mirror mygroup/myproject --direction=pull --url="https://username:token@gitlab.example.com/org/private-repo" ``` -------------------------------- ### Get CI/CD job trace using raw API Source: https://gitlab.com/gitlab-org/cli/-/blob/main/internal/commands/skills/bundled/assets/glab/SKILL.md Retrieve the trace of a specific CI/CD job using the raw GitLab API endpoint. ```shell glab api projects/:id/jobs//trace ``` -------------------------------- ### Run a CI/CD Pipeline Source: https://gitlab.com/gitlab-org/cli/-/blob/main/docs/source/ci/run.md Basic command to create a new CI/CD pipeline. Defaults to the current branch. ```console glab ci run ```