跳转到内容

cnb-rs repo branch create

cnb-rs repo branch create <NAME> [-s <REF>]

创建新分支。

参数

  • <NAME>: 新分支名(必填)

选项

  • -s, --start <REF>: 起始点(分支名 / commit sha / tag 名);缺省时自动取仓库默认分支

继承的全局选项:

  • --repo <REPO>: 指定仓库路径

示例

bash
# 从默认分支(main)拉新分支
cnb-rs --repo wwvo/cnb-rs/cnb-rs repo branch create feat/new-thing

# 从某个 commit 拉
cnb-rs --repo wwvo/cnb-rs/cnb-rs repo branch create hotfix --start a3f2c1d

# 从 tag 拉
cnb-rs --repo wwvo/cnb-rs/cnb-rs repo branch create backport-v1 --start v1.2.0

API

步骤API方法
取默认分支${CNB_API_ENDPOINT}/{repo}/-/git/headGET(仅 --start 未指定时调用)
创建分支${CNB_API_ENDPOINT}/{repo}/-/git/branchesPOST

另请参阅

Released under the MIT License.