bitbucket

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Bitbucket with orbit CLI

使用orbit CLI管理Bitbucket

Manage Bitbucket repositories, pull requests, branches, tags, commits, projects, and users through the
orbit
CLI. Works with both Bitbucket Server/Data Center and Cloud, with multi-profile support and 1Password secret resolution.
通过
orbit
CLI管理Bitbucket仓库、拉取请求(PR)、分支、标签、提交、项目和用户。支持Bitbucket Server/Data Center和Cloud版本,具备多配置文件支持和1Password密钥解析功能。

Prerequisites

前提条件

  1. orbit
    binary built and accessible
  2. A profile with a
    bitbucket
    service configured in
    ~/.config/orbit/config.yaml
  3. Valid credentials (Personal Access Token or Bearer token for Server; app password for Cloud) — can be stored in 1Password with
    op://
    prefix
  1. 已构建并可访问
    orbit
    二进制文件
  2. ~/.config/orbit/config.yaml
    中配置了带有
    bitbucket
    服务的配置文件
  3. 有效凭据(Server版本使用个人访问令牌或Bearer令牌;Cloud版本使用应用密码)——可存储在1Password中,前缀为
    op://

Quick Reference

快速参考

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

Addressing Convention

地址约定

Bitbucket Server/Data Center uses project-key + repo-slug to identify repositories. These are the two positional arguments most commands require:
  • Project key: uppercase short code (e.g.,
    L3SUP
    ,
    MYPROJ
    )
  • Repo slug: lowercase hyphenated name (e.g.,
    agents-sre
    ,
    my-service
    )
You can extract these from a Bitbucket Server URL:
https://git.example.com/projects/L3SUP/repos/agents-sre/
                                  ^^^^^       ^^^^^^^^^^
                              project-key     repo-slug
Bitbucket Server/Data Center使用项目密钥 + 仓库别名来标识仓库。这是大多数命令所需的两个位置参数:
  • 项目密钥:大写短代码(例如
    L3SUP
    MYPROJ
  • 仓库别名:小写连字符分隔的名称(例如
    agents-sre
    my-service
你可以从Bitbucket Server URL中提取这些信息:
https://git.example.com/projects/L3SUP/repos/agents-sre/
                                  ^^^^^       ^^^^^^^^^^
                              项目密钥     仓库别名

Core Workflows

核心工作流

Exploring Projects and Repos

浏览项目和仓库

bash
undefined
bash
undefined

List all projects

列出所有项目

orbit -p myprofile bb project list
orbit -p myprofile bb project list

View project details

查看项目详情

orbit -p myprofile bb project view L3SUP
orbit -p myprofile bb project view L3SUP

List repositories in a project

列出项目中的仓库

orbit -p myprofile bb repo list L3SUP
orbit -p myprofile bb repo list L3SUP

View repo details (includes clone URLs)

查看仓库详情(包含克隆URL)

orbit -p myprofile bb repo view L3SUP agents-sre
undefined
orbit -p myprofile bb repo view L3SUP agents-sre
undefined

Working with Pull Requests

处理拉取请求

Bitbucket uses "pull requests" (PR), same as GitHub.
bash
undefined
Bitbucket使用“拉取请求”(PR),与GitHub相同。
bash
undefined

List open PRs (default)

列出打开状态的PR(默认)

orbit -p myprofile bb pr list L3SUP agents-sre
orbit -p myprofile bb pr list L3SUP agents-sre

List merged PRs

列出已合并的PR

orbit -p myprofile bb pr list L3SUP agents-sre --state merged
orbit -p myprofile bb pr list L3SUP agents-sre --state merged

List all PRs

列出所有PR

orbit -p myprofile bb pr list L3SUP agents-sre --state all
orbit -p myprofile bb pr list L3SUP agents-sre --state all

View PR details (shows from/to branches, reviewers, approval status)

查看PR详情(显示源分支/目标分支、审核者、批准状态)

orbit -p myprofile bb pr view L3SUP agents-sre 42
orbit -p myprofile bb pr view L3SUP agents-sre 42

Create a PR

创建PR

orbit -p myprofile bb pr create L3SUP agents-sre
--from feature/new --to main --title "Add new feature"
orbit -p myprofile bb pr create L3SUP agents-sre
--from feature/new --to main --title "添加新功能"

Create a PR with reviewers

创建带审核者的PR

orbit -p myprofile bb pr create L3SUP agents-sre
--from feature/new --to main --title "Add feature"
--reviewers john.doe,jane.smith
orbit -p myprofile bb pr create L3SUP agents-sre
--from feature/new --to main --title "添加功能"
--reviewers john.doe,jane.smith

View PR diff (for code review)

查看PR差异(用于代码审查)

orbit -p myprofile bb pr diff L3SUP agents-sre 42
orbit -p myprofile bb pr diff L3SUP agents-sre 42

View PR diff with more context lines

查看带更多上下文行的PR差异

orbit -p myprofile bb pr diff L3SUP agents-sre 42 --context 10
orbit -p myprofile bb pr diff L3SUP agents-sre 42 --context 10

Merge a PR

合并PR

orbit -p myprofile bb pr merge L3SUP agents-sre 42
orbit -p myprofile bb pr merge L3SUP agents-sre 42

Merge a PR bypassing review checks (requires repo admin)

绕过审查检查合并PR(需要仓库管理员权限)

orbit -p myprofile bb pr merge L3SUP agents-sre 42 --bypass-review
orbit -p myprofile bb pr merge L3SUP agents-sre 42 --bypass-review

Decline a PR

拒绝PR

orbit -p myprofile bb pr decline L3SUP agents-sre 42
orbit -p myprofile bb pr decline L3SUP agents-sre 42

Add a comment to a PR

给PR添加评论

orbit -p myprofile bb pr comment L3SUP agents-sre 42 --body "LGTM!"
orbit -p myprofile bb pr comment L3SUP agents-sre 42 --body "LGTM!"

View PR activity (comments, approvals, status changes)

查看PR活动(评论、批准、状态变更)

orbit -p myprofile bb pr activity L3SUP agents-sre 42

**PR states:** `OPEN`, `MERGED`, `DECLINED`, `ALL`
orbit -p myprofile bb pr activity L3SUP agents-sre 42

**PR状态:** `OPEN`、`MERGED`、`DECLINED`、`ALL`

Branches and Tags

分支和标签

bash
undefined
bash
undefined

List branches

列出分支

orbit -p myprofile bb branch list L3SUP agents-sre
orbit -p myprofile bb branch list L3SUP agents-sre

Filter branches by name

按名称过滤分支

orbit -p myprofile bb branch list L3SUP agents-sre --filter feature
orbit -p myprofile bb branch list L3SUP agents-sre --filter feature

Show default branch

显示默认分支

orbit -p myprofile bb branch default L3SUP agents-sre
orbit -p myprofile bb branch default L3SUP agents-sre

Create a branch from a ref

从引用创建分支

orbit -p myprofile bb branch create L3SUP agents-sre feature/new-thing main
orbit -p myprofile bb branch create L3SUP agents-sre feature/new-thing main

Delete a branch

删除分支

orbit -p myprofile bb branch delete L3SUP agents-sre feature/old-thing
orbit -p myprofile bb branch delete L3SUP agents-sre feature/old-thing

List tags

列出标签

orbit -p myprofile bb tag list L3SUP agents-sre
orbit -p myprofile bb tag list L3SUP agents-sre

Create a tag

创建标签

orbit -p myprofile bb tag create L3SUP agents-sre v1.0.0 main -m "Release v1.0.0"
undefined
orbit -p myprofile bb tag create L3SUP agents-sre v1.0.0 main -m "Release v1.0.0"
undefined

Commits

提交

bash
undefined
bash
undefined

List recent commits (default branch)

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

orbit -p myprofile bb commit list L3SUP agents-sre
orbit -p myprofile bb commit list L3SUP agents-sre

List commits on a specific branch

列出特定分支上的提交

orbit -p myprofile bb commit list L3SUP agents-sre --branch feature/new
orbit -p myprofile bb commit list L3SUP agents-sre --branch feature/new

View commit details

查看提交详情

orbit -p myprofile bb commit view L3SUP agents-sre abc1234def5678
undefined
orbit -p myprofile bb commit view L3SUP agents-sre abc1234def5678
undefined

Users

用户

bash
undefined
bash
undefined

List users

列出用户

orbit -p myprofile bb user list
orbit -p myprofile bb user list

Filter users by name

按名称过滤用户

orbit -p myprofile bb user list --filter john
undefined
orbit -p myprofile bb user list --filter john
undefined

Common Patterns

常见模式

Get JSON for scripting:
bash
orbit -p myprofile bb pr list L3SUP agents-sre -o json | jq '.[].title'
Review a PR end-to-end:
bash
undefined
获取JSON格式用于脚本编写:
bash
orbit -p myprofile bb pr list L3SUP agents-sre -o json | jq '.[].title'
端到端审查PR:
bash
undefined

View PR details and reviewers

查看PR详情和审核者

orbit -p myprofile bb pr view L3SUP agents-sre 42
orbit -p myprofile bb pr view L3SUP agents-sre 42

Get the full diff for code review

获取完整差异用于代码审查

orbit -p myprofile bb pr diff L3SUP agents-sre 42
orbit -p myprofile bb pr diff L3SUP agents-sre 42

Check activity (approvals, comments)

检查活动(批准、评论)

orbit -p myprofile bb pr activity L3SUP agents-sre 42
orbit -p myprofile bb pr activity L3SUP agents-sre 42

Add your review comment

添加你的审查评论

orbit -p myprofile bb pr comment L3SUP agents-sre 42 --body "Approved, looks good"

**Extract project key and repo slug from a URL:**
Given `https://git.cnvrmedia.net/projects/L3SUP/repos/agents-sre/pull-requests`:
- Project key: `L3SUP`
- Repo slug: `agents-sre`
Then run: `orbit -p myprofile bb pr list L3SUP agents-sre`

**Check what repos exist in a project:**
```bash
orbit -p myprofile bb repo list L3SUP
orbit -p myprofile bb pr comment L3SUP agents-sre 42 --body "Approved, looks good"

**从URL中提取项目密钥和仓库别名:**
给定URL `https://git.cnvrmedia.net/projects/L3SUP/repos/agents-sre/pull-requests`:
- 项目密钥:`L3SUP`
- 仓库别名:`agents-sre`
然后运行:`orbit -p myprofile bb pr list L3SUP agents-sre`

**检查项目中有哪些仓库:**
```bash
orbit -p myprofile bb repo list L3SUP

Important Notes

重要说明

  • Profile required — Always pass
    -p <profile>
    to select the Bitbucket connection. The profile must have a service of type
    bitbucket
    configured.
  • Service flag — If a profile has multiple Bitbucket services, use
    --service <name>
    to disambiguate.
  • Server vs Cloud — The service variant (
    server
    or
    cloud
    ) in config determines the API prefix. Server uses
    /rest/api/latest/
    , Cloud uses
    /2.0/
    .
  • 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.
  • PR states are uppercase — Use
    OPEN
    ,
    MERGED
    ,
    DECLINED
    , or
    ALL
    (case-insensitive input is accepted).
  • Pagination — Most list commands default to 25-50 results. Use
    --limit N
    to adjust.
  • URL parsing — When a user provides a Bitbucket Server URL like
    https://host/projects/KEY/repos/SLUG/...
    , extract the project key and repo slug from the URL path to use with orbit commands.
  • 必须指定配置文件 — 始终通过
    -p <profile>
    参数选择Bitbucket连接。配置文件必须已配置类型为
    bitbucket
    的服务。
  • 服务标志 — 如果配置文件包含多个Bitbucket服务,请使用
    --service <name>
    参数来区分。
  • Server与Cloud版本 — 配置中的服务类型(
    server
    cloud
    )决定了API前缀。Server版本使用
    /rest/api/latest/
    ,Cloud版本使用
    /2.0/
  • 1Password集成 — 配置中的认证令牌可以使用
    op://vault/item/field
    格式,会在运行时解析。运行
    orbit auth
    一次即可解析并缓存所有密钥8小时(仅需一次生物特征验证)。使用
    orbit auth clear
    清除缓存。
  • PR状态为大写 — 使用
    OPEN
    MERGED
    DECLINED
    ALL
    (接受不区分大小写的输入)。
  • 分页 — 大多数列表命令默认返回25-50条结果。使用
    --limit N
    参数调整数量。
  • URL解析 — 当用户提供Bitbucket Server URL(例如
    https://host/projects/KEY/repos/SLUG/...
    )时,从URL路径中提取项目密钥和仓库别名,用于orbit命令。