已关闭
feat: gc repo branch list/create — 分支列举与创建 #534
aflyingto创建于  8月11日关闭于  8月11日
aflyingto成员
8月11日 创建

背景

前序排查遗漏。gc 仅有 repo branch view,缺少分支列举与创建。API 已就绪。

API 端点(2 个)

子命令 方法 路径 标题
gc repo branch list GET /api/v5/repos/{owner}/{repo}/branches 获取项目所有分支
gc repo branch create POST /api/v5/repos/{owner}/{repo}/branches 创建分支

命令接口

gc repo branch list [-R owner/repo] [--json] [--limit N]
gc repo branch create <branch-name> --ref <ref> [-R owner/repo] --yes

对齐 gh

gh 在 gh repo view 中隐式展示默认分支,gh api 可列举分支。gc 应原生支持。

验收标准

Refs gitcode-cli/cli#517

likedislike
Aaflyingto成员
8月11日 关联了里程碑:gh-parity: 全面对齐 gh CLI
Aaflyingto成员
8月11日 添加了label:enhancementscope/cli
aflyingto成员
8月11日 评论:

验证记录

验证版本: main (972bdf8)
验证命令: gc repo branch --help + 源码审查 api/queries_repo.go、pkg/cmd/repo/branch/
验证结果:

  • gc repo branch 仅有 view 子命令,缺少 list 和 create
  • api.GetBranch 已实现(GET /repos/{owner}/{repo}/branches/{branch})
  • api.Branch 类型已有 Name/Protected/Commit/BranchCommit 字段
  • API 文档确认 GET /branches 返回数组(含 name/description/commit/default_branch/created_at/creator/protected)
  • POST /branches 请求体含 refs(起点)、branch_name、description
  • 现有 DeleteBranch 提供了 POST 模式参考

结论: 确认功能缺失,API 模式和 Branch 类型已就绪。

likedislike
Aaflyingto成员
8月11日 关联了pull request:feat(repo): add gc repo branch list and create subcommands
Aaflyingto成员
8月11日 关闭了 issue