gitlab

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

GitLab with orbit CLI

借助orbit CLI管理GitLab

Manage GitLab projects, merge requests, pipelines, issues, branches, tags, commits, members, and users through the
orbit
CLI. Works with both GitLab Cloud and self-hosted instances via REST API v4, with multi-profile support and 1Password secret resolution.
通过
orbit
CLI管理GitLab的项目、合并请求、流水线、问题、分支、标签、提交、成员和用户。支持GitLab Cloud和自托管实例,基于REST API v4,具备多配置文件支持和1Password密钥解析功能。

Prerequisites

前置条件

  1. orbit
    binary built and accessible
  2. A profile with a
    gitlab
    service configured in
    ~/.config/orbit/config.yaml
  3. Valid credentials (Personal Access Token or Bearer token) — can be stored in 1Password with
    op://
    prefix
  1. 已构建并可访问
    orbit
    二进制文件
  2. ~/.config/orbit/config.yaml
    中配置了包含
    gitlab
    服务的配置文件
  3. 有效的凭证(个人访问令牌或Bearer令牌)——可通过
    op://
    前缀存储在1Password中

Quick Reference

快速参考

All commands follow the pattern:
orbit -p <profile> gitlab <command> [flags]
Alias:
orbit -p <profile> gl <command> [flags]
All commands support
-o json
for JSON output. For full command details and all flags, see
references/commands.md
.
所有命令遵循以下格式:
orbit -p <profile> gitlab <command> [flags]
别名:
orbit -p <profile> gl <command> [flags]
所有命令支持
-o json
参数以输出JSON格式。如需完整命令详情及所有参数,请查看
references/commands.md

Project Identification

项目标识

Projects can be referenced by numeric ID or full path:
  • orbit -p myprofile gl project 595
  • orbit -p myprofile gl project schools/frontend/my-app
Groups also accept ID or full path:
schools/frontend
项目可通过数字ID或完整路径引用:
  • orbit -p myprofile gl project 595
  • orbit -p myprofile gl project schools/frontend/my-app
群组同样支持ID或完整路径:
schools/frontend

Core Workflows

核心工作流

Exploring Projects and Groups

探索项目与群组

bash
undefined
bash
undefined

View project details

查看项目详情

orbit -p myprofile gl project schools/frontend/my-app
orbit -p myprofile gl project schools/frontend/my-app

List your projects (membership-based)

列出你的项目(基于成员身份)

orbit -p myprofile gl projects --search frontend
orbit -p myprofile gl projects --search frontend

List all projects in a group (includes subgroups)

列出群组中的所有项目(包含子群组)

orbit -p myprofile gl projects --group schools/frontend
orbit -p myprofile gl projects --group schools/frontend

View group info

查看群组信息

orbit -p myprofile gl group view schools/frontend
orbit -p myprofile gl group view schools/frontend

List subgroups

列出子群组

orbit -p myprofile gl group subgroups schools
undefined
orbit -p myprofile gl group subgroups schools
undefined

Working with Merge Requests

处理合并请求

GitLab calls them "merge requests" (MR), equivalent to GitHub's "pull requests" (PR).
bash
undefined
GitLab中称为“合并请求”(MR),等同于GitHub的“拉取请求”(PR)。
bash
undefined

List open MRs

列出开放的MR

orbit -p myprofile gl mr list 595
orbit -p myprofile gl mr list 595

List merged MRs

列出已合并的MR

orbit -p myprofile gl mr list 595 --state merged
orbit -p myprofile gl mr list 595 --state merged

View MR details (shows source/target branch, conflicts, review status)

查看MR详情(显示源/目标分支、冲突、审核状态)

orbit -p myprofile gl mr view 595 42
orbit -p myprofile gl mr view 595 42

Create an MR

创建MR

orbit -p myprofile gl mr create 595
--source feature/login --target main --title "Add login page"
orbit -p myprofile gl mr create 595
--source feature/login --target main --title "Add login page"

Merge an MR (with optional squash)

合并MR(可选压缩提交)

orbit -p myprofile gl mr merge 595 42 --squash
orbit -p myprofile gl mr merge 595 42 --squash

Add a comment

添加评论

orbit -p myprofile gl mr comment 595 42 --body "LGTM!"
orbit -p myprofile gl mr comment 595 42 --body "LGTM!"

List discussion comments (excludes system notes)

列出讨论评论(排除系统通知)

orbit -p myprofile gl mr notes 595 42
undefined
orbit -p myprofile gl mr notes 595 42
undefined

CI/CD Pipelines

CI/CD流水线

bash
undefined
bash
undefined

List recent pipelines

列出近期流水线

orbit -p myprofile gl pipeline list 595
orbit -p myprofile gl pipeline list 595

Filter by branch and status

按分支和状态筛选

orbit -p myprofile gl pipeline list 595 --ref main --status failed
orbit -p myprofile gl pipeline list 595 --ref main --status failed

View pipeline details

查看流水线详情

orbit -p myprofile gl pipeline view 595 12345
orbit -p myprofile gl pipeline view 595 12345

List jobs in a pipeline (shows stage, status, duration)

列出流水线中的任务(显示阶段、状态、时长)

orbit -p myprofile gl pipeline jobs 595 12345
orbit -p myprofile gl pipeline jobs 595 12345

Retry a failed pipeline

重试失败的流水线

orbit -p myprofile gl pipeline retry 595 12345
orbit -p myprofile gl pipeline retry 595 12345

Cancel a running pipeline

取消运行中的流水线

orbit -p myprofile gl pipeline cancel 595 12345

Pipeline aliases: `pipeline`, `pipe`, `ci` — so `orbit gl ci list 595` works too.
orbit -p myprofile gl pipeline cancel 595 12345

流水线别名:`pipeline`、`pipe`、`ci`——因此`orbit gl ci list 595`同样可用。

Branches and Tags

分支与标签

bash
undefined
bash
undefined

List branches

列出分支

orbit -p myprofile gl branch list 595 --search feature
orbit -p myprofile gl branch list 595 --search feature

View branch details (includes latest commit)

查看分支详情(包含最新提交)

orbit -p myprofile gl branch view 595 main
orbit -p myprofile gl branch view 595 main

Create a branch from a ref

从指定引用创建分支

orbit -p myprofile gl branch create 595 feature/new-thing main
orbit -p myprofile gl branch create 595 feature/new-thing main

Delete a branch

删除分支

orbit -p myprofile gl branch delete 595 feature/old-thing
orbit -p myprofile gl branch delete 595 feature/old-thing

List tags

列出标签

orbit -p myprofile gl tag list 595
orbit -p myprofile gl tag list 595

Create an annotated tag

创建带注释的标签

orbit -p myprofile gl tag create 595 v1.0.0 main -m "Release v1.0.0"
undefined
orbit -p myprofile gl tag create 595 v1.0.0 main -m "Release v1.0.0"
undefined

Commits

提交

bash
undefined
bash
undefined

List recent commits (default branch)

列出近期提交(默认分支)

orbit -p myprofile gl commit list 595
orbit -p myprofile gl commit list 595

List commits on a specific branch

列出指定分支的提交

orbit -p myprofile gl commit list 595 --ref feature/login
orbit -p myprofile gl commit list 595 --ref feature/login

View commit details

查看提交详情

orbit -p myprofile gl commit view 595 abc1234
undefined
orbit -p myprofile gl commit view 595 abc1234
undefined

Issues

问题

bash
undefined
bash
undefined

List open issues

列出开放的问题

orbit -p myprofile gl issue list 595 --state opened
orbit -p myprofile gl issue list 595 --state opened

Filter by labels

按标签筛选

orbit -p myprofile gl issue list 595 --labels bug,urgent
orbit -p myprofile gl issue list 595 --labels bug,urgent

View issue details

查看问题详情

orbit -p myprofile gl issue view 595 1
orbit -p myprofile gl issue view 595 1

Create an issue

创建问题

orbit -p myprofile gl issue create 595 --title "Fix login bug" --labels bug,urgent
orbit -p myprofile gl issue create 595 --title "Fix login bug" --labels bug,urgent

Close an issue

关闭问题

orbit -p myprofile gl issue close 595 1
undefined
orbit -p myprofile gl issue close 595 1
undefined

Members and Users

成员与用户

bash
undefined
bash
undefined

List project members (shows access level: Guest/Reporter/Developer/Maintainer/Owner)

列出项目成员(显示权限等级:访客/报告者/开发者/维护者/所有者)

orbit -p myprofile gl member list 595
orbit -p myprofile gl member list 595

Show current authenticated user

显示当前已认证用户

orbit -p myprofile gl user me
orbit -p myprofile gl user me

Search users

搜索用户

orbit -p myprofile gl user list --search john
undefined
orbit -p myprofile gl user list --search john
undefined

Common Patterns

常见用法

Get JSON for scripting: Any command supports
-o json
for machine-readable output:
bash
orbit -p myprofile gl mr list 595 -o json | jq '.[].title'
Check CI status for a branch:
bash
orbit -p myprofile gl pipeline list 595 --ref main --limit 1
Find who's working on a project:
bash
orbit -p myprofile gl member list 595
Review an MR end-to-end:
bash
undefined
获取JSON格式用于脚本开发: 任何命令都支持
-o json
参数以输出机器可读的JSON格式:
bash
orbit -p myprofile gl mr list 595 -o json | jq '.[].title'
检查分支的CI状态:
bash
orbit -p myprofile gl pipeline list 595 --ref main --limit 1
查看项目的参与人员:
bash
orbit -p myprofile gl member list 595
完整审核MR:
bash
undefined

View MR details

查看MR详情

orbit -p myprofile gl mr view 595 42
orbit -p myprofile gl mr view 595 42

Check its pipeline

检查其关联的流水线

orbit -p myprofile gl pipeline list 595 --ref feature/login --limit 1
orbit -p myprofile gl pipeline list 595 --ref feature/login --limit 1

Read discussion

查看讨论内容

orbit -p myprofile gl mr notes 595 42
orbit -p myprofile gl mr notes 595 42

Approve with comment

附评论批准

orbit -p myprofile gl mr comment 595 42 --body "Approved, looks good"
undefined
orbit -p myprofile gl mr comment 595 42 --body "Approved, looks good"
undefined

Important Notes

重要说明

  • Profile required — Always pass
    -p <profile>
    to select the GitLab connection. The profile must have a service of type
    gitlab
    configured.
  • Service flag — If a profile has multiple GitLab services, use
    --service <name>
    to disambiguate.
  • Cloud vs Self-hosted — Works with both. The base URL in your profile config determines the GitLab instance.
  • 1Password integration — Auth tokens in config can use
    op://vault/item/field
    and are resolved at runtime. Run
    orbit auth
    once to resolve and cache all secrets for 8 hours (single biometric prompt). Use
    orbit auth clear
    to wipe the cache.
  • MR = PR — If a user says "pull request" or "PR" in a GitLab context, they mean merge request.
  • Pagination — Most list commands default to 20-50 results. Use
    --limit N
    to adjust.
  • 必须指定配置文件 — 请始终通过
    -p <profile>
    参数选择GitLab连接。该配置文件必须包含类型为
    gitlab
    的服务配置。
  • 服务参数 — 如果一个配置文件包含多个GitLab服务,请使用
    --service <name>
    参数进行区分。
  • 云与自托管 — 两者均支持。配置文件中的基础URL将决定使用的GitLab实例。
  • 1Password集成 — 配置中的认证令牌可使用
    op://vault/item/field
    格式,会在运行时解析。运行
    orbit auth
    一次即可解析并缓存所有密钥8小时(仅需一次生物识别验证)。使用
    orbit auth clear
    可清除缓存。
  • MR等同于PR — 如果用户在GitLab语境下提到“拉取请求”或“PR”,实际指的是合并请求。
  • 分页 — 大多数列表命令默认返回20-50条结果。可使用
    --limit N
    参数调整数量。