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.0API
| 步骤 | API | 方法 |
|---|---|---|
| 取默认分支 | ${CNB_API_ENDPOINT}/{repo}/-/git/head | GET(仅 --start 未指定时调用) |
| 创建分支 | ${CNB_API_ENDPOINT}/{repo}/-/git/branches | POST |