new-branch

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

New Branch

新建分支

Quick Start

快速开始

Given an issue reference, follow workflows/issue-branch.md.
Example: issue
#42
titled
Let agents use GitHub more ergonomically
becomes local branch
42-let-agents-use-github-more-ergonomically
.
The skill creates or switches to the local issue branch only. It does not install dependencies, push, commit, create a pull request, or start implementation work.
给定一个Issue引用,请遵循workflows/issue-branch.md
示例:编号为
#42
、标题为
Let agents use GitHub more ergonomically
的Issue,会生成本地分支
42-let-agents-use-github-more-ergonomically
该技能仅创建或切换到本地Issue分支,不会安装依赖、推送、提交、创建拉取请求(Pull Request)或启动实现工作。

Workflow

工作流程

  1. Read the repository guidance first, especially branch and GitHub rules.
  2. Resolve the issue in the current working directory's default
    gh
    repository.
  3. Compute the branch name as
    <issue-number>-<kebab-title>
    , matching GitHub's issue branch suggestion.
  4. Refuse to switch branches when the worktree has uncommitted changes.
  5. Fetch the repository default branch from
    origin
    .
  6. Create the branch from
    origin/<default-branch>
    , switch to it, or warn before leaving a different issue branch.
  7. Report the branch and base SHA.
  1. 首先阅读仓库指南,尤其是分支和GitHub规则。
  2. 在当前工作目录的默认
    gh
    仓库中解析该Issue。
  3. 按照
    <issue-number>-<kebab-title>
    的格式生成分支名称,与GitHub的Issue分支建议格式匹配。
  4. 当工作区存在未提交的更改时,拒绝切换分支。
  5. origin
    拉取仓库默认分支。
  6. 基于
    origin/<default-branch>
    创建分支并切换到该分支;若当前处于其他Issue分支,会先发出警告再切换。
  7. 报告分支名称和基准SHA值。

Guardrails

防护规则

  • Stay in the current
    gh
    repository; do not accept cross-repo flags.
  • Never hardcode
    main
    ; resolve the default branch through
    gh repo view
    .
  • Keep empty issue branches local.
  • Ask before switching away from a different issue branch.
  • Stop on rebase conflicts and surface the manual resolution steps.
  • 仅在当前
    gh
    仓库内操作,不接受跨仓库参数。
  • 绝不硬编码
    main
    分支,通过
    gh repo view
    命令解析默认分支。
  • 空的Issue分支仅保留在本地。
  • 切换离开其他Issue分支前需询问用户。
  • 遇到变基冲突时停止操作,并提示手动解决步骤。