跳转到内容

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_BRANCH

API

GET ${CNB_API_ENDPOINT}/{repo}/-/git/head

另请参阅

Released under the MIT License.