git-branch-format
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGit Branch Format Skill
Git分支命名格式技能
Generates a branch name from a description of changes.
根据变更描述生成分支名称。
Convention
命名规范
With ticket number
带工单编号的情况
{type}/{TICKET_NUMBER}_{short_description}- is uppercase as provided by the user (e.g.
TICKET_NUMBER)PROJ-548 - is
short_description, max 3 words — prefer 1–2snake_case - Example:
feat/TICKET-548_flutter_upgrade
{type}/{TICKET_NUMBER}_{short_description}- 采用用户提供的大写格式(例如
TICKET_NUMBER)PROJ-548 - 使用
short_description命名法,最多3个单词——优先使用1-2个snake_case - 示例:
feat/TICKET-548_flutter_upgrade
Without ticket number
不带工单编号的情况
{type}/{short_description}- is
short_description, max 3 words — prefer 1–2snake_case - Example:
feat/flutter_upgrade
Never use placeholders like . If there's no ticket, just omit that part entirely.
NO-TICKET{type}/{short_description}- 使用
short_description命名法,最多3个单词——优先使用1-2个snake_case - 示例:
feat/flutter_upgrade
切勿使用这类占位符。如果没有工单编号,直接省略该部分即可。
NO-TICKETType Selection Guide
类型选择指南
| Type | When to use |
|---|---|
| New functionality |
| Bug fix |
| Code change with no behavior change |
| Config, deps, tooling, maintenance |
| Adding or updating tests |
| Documentation only |
| Formatting, whitespace |
| Performance improvement |
| CI/CD changes |
| Build system changes |
| Reverting a previous commit |
| 类型 | 使用场景 |
|---|---|
| 新增功能 |
| 修复Bug |
| 不改变功能的代码变更 |
| 配置、依赖、工具、维护类工作 |
| 添加或更新测试 |
| 仅修改文档 |
| 格式调整、空白字符修改 |
| 性能优化 |
| CI/CD相关变更 |
| 构建系统变更 |
| 回滚之前的提交 |
Workflow
工作流程
- Read the user's description of changes.
- Ask: "Do you have a ticket number for this?" — if the user doesn't provide one, proceed without it.
- Infer the correct from the nature of the changes.
type - Generate the branch name following the convention above.
- 读取用户的变更描述。
- 询问:“您有对应的工单编号吗?”——如果用户未提供,则直接跳过该部分。
- 根据变更的性质推断正确的。
type - 按照上述规范生成分支名称。
Examples
示例
User: "I'm adding dark mode support" — Ticket: PROJ-312
feat/PROJ-312_dark_mode_supportUser: "fixing a crash on the payment screen" — No ticket
fix/payment_screen_crashUser: "upgrading Flutter and fixing deprecated APIs" — Ticket: PROJ-548
feat/PROJ-548_flutter_upgrade用户:“我要添加深色模式支持”——工单编号:PROJ-312
feat/PROJ-312_dark_mode_support用户:“修复支付页面的崩溃问题”——无工单编号
fix/payment_screen_crash用户:“升级Flutter并修复已废弃的API”——工单编号:PROJ-548
feat/PROJ-548_flutter_upgrade