branch
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseBranch
分支
Create a traceable Git branch for the current task.
为当前任务创建可追溯的Git分支。
Workflow
工作流程
- Inspect the current Git branch, , and available task context.
git status - Identify the ticket ID when the work comes from an issue tracker. If the task has a ticket but no visible ID, ask for it.
- Use the user's branch name if provided; if work from an issue tracker omits the ticket ID, ask before creating it.
- Otherwise derive when there is a ticket ID, or
<ticket-id>-<short-kebab-summary>when there is not.<short-kebab-summary> - Preserve an obvious repo prefix such as only if the ticket ID remains visible.
feature/ - If the branch already exists, switch to it. Otherwise, create and switch to it.
- Report the branch name and any uncommitted work that was already present.
- 检查当前Git分支、以及可用的任务上下文。
git status - 当工作来自问题追踪器时,识别工单ID。如果任务有工单但未显示ID,请询问用户。
- 如果用户提供了分支名称则使用该名称;如果来自问题追踪器的工作未包含工单ID,创建分支前请先询问用户。
- 否则,当有工单ID时,分支名称格式为;没有工单ID时,格式为
<ticket-id>-<短横线分隔的简短摘要>。<短横线分隔的简短摘要> - 仅当工单ID可见时,保留明显的仓库前缀(如)。
feature/ - 如果分支已存在,则切换到该分支;否则创建并切换到该分支。
- 报告分支名称以及已存在的所有未提交工作。
Rules
规则
- Stop if the working tree state makes switching branches unsafe.
- Do not overwrite or discard uncommitted work.
- Include the ticket ID for work from an issue tracker.
- Do not invent ticket IDs.
- 若工作树状态导致切换分支不安全,则停止操作。
- 不得覆盖或丢弃未提交的工作。
- 对于来自问题追踪器的工作,需包含工单ID。
- 不得编造工单ID。