branch-create
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseFeature Branch Creation
Feature分支创建
Create a feature branch linked to an issue with a consistent naming convention. Works in any Git repository.
创建与Issue关联且命名规范统一的Feature分支。适用于所有Git仓库。
Workflow
工作流程
Step 1: Collect Input
步骤1:收集输入信息
Gather the issue number for the branch name.
- Ask the user for the issue number. If provided as an argument, use it directly.
- If the issue number is provided, verify it exists with . If the issue does not exist, inform the user and stop.
gh issue view <number> - Derive a short description from the issue title automatically. Only ask the user for a description if the issue has no title.
收集用于生成分支名称的Issue编号。
- 向用户询问Issue编号。如果已作为参数提供,则直接使用该编号。
- 如果用户提供了Issue编号,使用命令验证该Issue是否存在。若Issue不存在,则告知用户并终止操作。
gh issue view <number> - 自动从Issue标题中提取简短描述。仅当Issue无标题时,才向用户询问描述内容。
Step 2: Generate Branch Name
步骤2:生成分支名称
Generate the branch name following the project's naming convention.
- Default convention:
feature/<issue-number>-<description> - Convert the description to lowercase kebab-case:
- Replace spaces and underscores with hyphens
- Remove special characters
- Collapse consecutive hyphens
If the project has a different convention documented (e.g., in CLAUDE.md or CONTRIBUTING.md), follow that convention instead.
按照项目的命名规范生成分支名称。
- 默认规范:
feature/<issue-number>-<description> - 将描述转换为小写短横线命名格式(kebab-case):
- 将空格和下划线替换为短横线
- 移除特殊字符
- 合并连续的短横线
如果项目文档中规定了其他命名规范(例如在CLAUDE.md或CONTRIBUTING.md文件中),则遵循该规范。
Step 3: Create and Checkout
步骤3:创建并检出分支
- If a branch with the same name already exists, inform the user and ask whether to:
- Checkout the existing branch, or
- Choose a different name
- Create the branch from the current HEAD:
git checkout -b <branch-name> - Display the branch name and associated issue number.
- 如果同名分支已存在,告知用户并询问其选择:
- 检出已存在的分支,或
- 选择其他分支名称
- 基于当前HEAD创建分支:
git checkout -b <branch-name> - 显示分支名称及关联的Issue编号。
Constraints
约束条件
- Do not push the branch to remote automatically. The user decides when to push.
- Do not modify the issue (no labels, no assignees) -- branch creation is the only action.
- 不自动将分支推送到远程仓库,由用户决定推送时机。
- 不得修改Issue(不添加标签、不指派处理人)——仅执行分支创建操作。