@contentstack/cli-cm-branches

中文文档
2.0.2发布于 2026/10/06MITTypeScriptCommonJS近 30 天下载 4.4万

Contentstack CLI plugin to do branches operations

原始使用文档
文档目录6 节
  1. csdx cm:branches
  2. csdx cm:branches:create
  3. csdx cm:branches:delete [-uid <value>] [-k <value>]
  4. csdx cm:branches:diff [--base-branch <value>] [--compare-br…
  5. csdx cm:branches:merge [-k <value>][--compare-branch <value…
  6. csdx cm:branches:merge-status -k <value> --merge-uid <value>

@contentstack/cli-cm-branches

It is Contentstack’s CLI plugin to compare and merge content. License

To switch regions, use the csdx config:set:region command instead of manually editing config files.

Usage

$ npm install -g @contentstack/cli-cm-branches
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-cm-branches/2.0.2 linux-x64 node-v22.23.3
$ csdx --help [COMMAND]
USAGE
  $ csdx COMMAND
...

Commands

csdx cm:branches

List the branches

USAGE
  $ csdx cm:branches

FLAGS
  -k, --stack-api-key=<value>  Stack API key
      --verbose                Verbose, display information in detailed format.

DESCRIPTION
  List the branches

EXAMPLES
  $ csdx cm:branches

  $ csdx cm:branches --verbose

  $ csdx cm:branches -k <stack api key>

See code: src/commands/cm/branches/index.ts

csdx cm:branches:create

Create a new branch

USAGE
  $ csdx cm:branches:create
  $ csdx cm:branches:create [--source <value>] [--uid <value>] [-k <value>]
  $ csdx cm:branches:create [--source <value>] [--uid <value>] [--stack-api-key <value>]

FLAGS
  -k, --stack-api-key=<value>  Stack API key
      --source=<value>         Source branch from which a new branch is to be created.
      --uid=<value>            Branch UID (unique name) to be created.

DESCRIPTION
  Create a new branch

EXAMPLES
  $ csdx cm:branches:create

  $ csdx cm:branches:create --source main --uid new_branch -k bltxxxxxxxx

  $ csdx cm:branches:create --source main --uid new_branch --stack-api-key bltxxxxxxxx

See code: src/commands/cm/branches/create.ts

csdx cm:branches:delete [-uid <value>] [-k <value>]

Delete a branch

USAGE
  $ csdx cm:branches:delete [-uid <value>] [-k <value>]
  $ csdx cm:branches:delete [--uid <value>] [--stack-api-key <value>]

FLAGS
  -k, --stack-api-key=<value>  Stack API key
  -y, --yes                    Force the deletion of the branch by skipping the confirmation
      --uid=<value>            Branch UID to be deleted

DESCRIPTION
  Delete a branch

EXAMPLES
  $ csdx cm:branches:delete

  $ csdx cm:branches:delete --uid main -k bltxxxxxxxx

  $ csdx cm:branches:delete --uid main --stack-api-key bltxxxxxxxx

  $ csdx cm:branches:delete --uid main --stack-api-key bltxxxxxxxx --yes

See code: src/commands/cm/branches/delete.ts

csdx cm:branches:diff [--base-branch <value>] [--compare-branch <value>] [-k <value>][--module <value>] [--format <value>] [--csv-path <value>]

Differences between two branches

USAGE
  $ csdx cm:branches:diff [--base-branch <value>] [--compare-branch <value>] [-k <value>][--module <value>] [--format
    <value>] [--csv-path <value>]

FLAGS
  -k, --stack-api-key=<value>   [optional] Provide the stack API key to show the difference between branches.
      --base-branch=<value>     [optional] Base branch (Target branch).
      --compare-branch=<value>  [optional] Compare branch (Source branch).
      --csv-path=<value>        [optional] Custom path for CSV output file. If not provided, will use the current
                                working directory.
      --format=<option>         [default: compact-text] [default: compact-text] [optional] Type of flags to show the
                                difference between two branches. <options: compact-text, detailed-text>
                                <options: compact-text|detailed-text>
      --module=<option>         [optional] Module. <options: content-types, global-fields, all>
                                <options: content-types|global-fields|all>

DESCRIPTION
  Differences between two branches

EXAMPLES
  $ csdx cm:branches:diff

  $ csdx cm:branches:diff --stack-api-key "bltxxxxxxxx"

  $ csdx cm:branches:diff --compare-branch "develop"

  $ csdx cm:branches:diff --compare-branch "develop" --stack-api-key "bltxxxxxxxx"

  $ csdx cm:branches:diff --compare-branch "develop" --module "content-types"

  $ csdx cm:branches:diff --module "content-types" --format "detailed-text"

  $ csdx cm:branches:diff --compare-branch "develop" --format "detailed-text"

  $ csdx cm:branches:diff --stack-api-key "bltxxxxxxxx" --base-branch "main"

  $ csdx cm:branches:diff --stack-api-key "bltxxxxxxxx" --base-branch "main" --compare-branch "develop"

  $ csdx cm:branches:diff --stack-api-key "bltxxxxxxxx" --base-branch "main" --module "content-types"

  $ csdx cm:branches:diff --stack-api-key "bltxxxxxxxx" --base-branch "main" --compare-branch "develop" --module "content-types"

  $ csdx cm:branches:diff --stack-api-key "bltxxxxxxxx" --base-branch "main" --compare-branch "develop" --module "content-types" --format "detailed-text"

  $ csdx cm:branches:diff --stack-api-key "bltxxxxxxxx" --base-branch "main" --compare-branch "develop" --module "content-types" --format "compact-text"

  $ csdx cm:branches:diff --stack-api-key "bltxxxxxxxx" --base-branch "main" --compare-branch "develop" --module "content-types" --format "detailed-text" --csv-path "./reports/diff-report.csv"

See code: src/commands/cm/branches/diff.ts

csdx cm:branches:merge [-k <value>][--compare-branch <value>] [--no-revert] [--export-summary-path <value>] [--use-merge-summary <value>] [--comment <value>] [--base-branch <value>]

Merge changes from a branch

USAGE
  $ csdx cm:branches:merge [-k <value>][--compare-branch <value>] [--no-revert] [--export-summary-path <value>]
    [--use-merge-summary <value>] [--comment <value>] [--base-branch <value>]

FLAGS
  -k, --stack-api-key=<value>        [optional] Provide stack API key to show the difference between the branches.
      --base-branch=<value>          [optional] Base branch (Target branch).
      --comment=<value>              [optional] Pass a comment.
      --compare-branch=<value>       [optional] Compare branch (Source branch).
      --export-summary-path=<value>  [optional] Export summary file path.
      --no-revert                    [optional] If passed, will not create the new revert branch.
      --use-merge-summary=<value>    [optional] Path of merge summary file.

DESCRIPTION
  Merge changes from a branch

EXAMPLES
  $ csdx cm:branches:merge --stack-api-key bltxxxxxxxx --compare-branch feature-branch

  $ csdx cm:branches:merge --stack-api-key bltxxxxxxxx --comment "merge comment"

  $ csdx cm:branches:merge -k bltxxxxxxxx --base-branch base-branch

  $ csdx cm:branches:merge --export-summary-path file/path

  $ csdx cm:branches:merge --use-merge-summary file-path

  $ csdx cm:branches:merge -k bltxxxxxxxx --no-revert

  $ csdx cm:branches:merge -k bltxxxxxxxx --compare-branch feature-branch --no-revert

See code: src/commands/cm/branches/merge.ts

csdx cm:branches:merge-status -k <value> --merge-uid <value>

Check the status of a branch merge job

USAGE
  $ csdx cm:branches:merge-status -k <value> --merge-uid <value>

FLAGS
  -k, --stack-api-key=<value>  (required) Provide your stack API key.
      --merge-uid=<value>      (required) Merge job UID to check status for.

DESCRIPTION
  Check the status of a branch merge job

EXAMPLES
  $ csdx cm:branches:merge-status -k bltxxxxxxxx --merge-uid merge_abc123

  $ csdx cm:branches:merge-status --stack-api-key bltxxxxxxxx --merge-uid merge_abc123

See code: src/commands/cm/branches/merge-status.ts

版本与发布记录

@contentstack/cli-cm-branches 共发布 74 个版本,首次发布于 2023/05/12;过去 12 个月发布了 29 个版本。

版本发布日期距今
2.0.2latest2026/10/061 个月前
1.8.7v1-x2026/10/061 个月前
2.0.12026/09/151 个月前
1.8.62026/08/132 个月前
2.0.02026/08/122 个月前
1.8.52026/08/053 个月前

其他发布通道:beta → 2.0.0-beta.11,v1-x → 1.8.7。

关于 @contentstack/cli-cm-branches 的常见问题

@contentstack/cli-cm-branches 是什么?

Contentstack CLI plugin to do branches operations

如何安装 @contentstack/cli-cm-branches?

在项目目录运行 npm install @contentstack/cli-cm-branches,或使用 pnpm add / yarn add / bun add。

@contentstack/cli-cm-branches 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@contentstack/cli-cm-branches 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@contentstack/cli-cm-branches 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@contentstack/cli-cm-branches 可以商用吗?

@contentstack/cli-cm-branches 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@contentstack/cli-cm-branches 的下载量有多少?

根据 npm 官方下载统计,@contentstack/cli-cm-branches 在 2026/10/11 – 2026/11/09 这 30 天内被下载 44,052 次,日均约 1,468 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@contentstack/cli-cm-branches 还在维护吗?

最新版本 2.0.2 发布于 2026/10/06(1 个月前);至今共发布 74 个版本,其中过去 12 个月发布了 29 个;首次发布于 2023/05/12。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。