cnb-rs repo file head
cnb-rs repo file head查仓库的默认分支(HEAD ref)。
输出字段
Name— 默认分支名(如main)Protected— 是否是保护分支
脚本场景
bash
# 用 JSON + jq 拿默认分支名
DEFAULT_BRANCH=$(cnb-rs --repo $REPO repo file head --json | jq -r .name)
git checkout $DEFAULT_BRANCHAPI
GET ${CNB_API_ENDPOINT}/{repo}/-/git/head
另请参阅
- cnb-rs repo file
- cnb-rs repo branch create — 创建分支时
--start缺省也走 HEAD - cnb-rs repo tag create — 打 tag 时
--target缺省也走 HEAD