Files
nexus/wiki/concepts/Branch-Strategy.md

40 lines
1.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "Branch Strategy"
type: concept
tags: ["git", "workflow", "delivery-traceability"]
last_updated: 2026-04-25
---
## Definition
Branch Strategy分支策略是一套基于变更类型的分支分层管理模型通过规范化分支命名和来源规则确保各类型的代码变更在正确的上下文中开发、审查和合并。
## Branch Types
| 类型 | 模式 | 来源分支 | 目标分支 | 典型场景 |
|------|------|----------|----------|----------|
| Feature | `feature/JIRA-ID-description` | develop | develop | 新产品或平台功能 |
| Bugfix | `bugfix/JIRA-ID-description` | develop | develop | 非关键缺陷修复 |
| Hotfix | `hotfix/JIRA-ID-description` | main | main | 关键生产环境修复 |
| Refactor | `feature/JIRA-ID-description` | develop | develop | 结构清理(需关联 Jira 任务) |
| Docs | `feature/JIRA-ID-description` | develop | develop | 文档更新(需关联 Jira 任务) |
| Tests | `bugfix/JIRA-ID-description` | develop | develop | 回归测试(需关联 Jira 任务) |
| Config | `feature/JIRA-ID-description` | develop | develop | 配置或工作流策略变更 |
| Dependencies | `bugfix/JIRA-ID-description` | develop | develop | 依赖或平台升级 |
| Release | `release/version` | develop | main | 发布准备 |
## Protected Branches
- `main`:始终生产就绪;所有合并必须经过 PR review
- `develop`持续集成的集成分支feature/bugfix 从其拉取
- `release/*`:发布准备分支;仍需关联 release ticket 或变更控制项
## Relationship to Other Concepts
- [[Atomic-Commit]]:在 branch 内部进一步原子化 commit
- [[Jira-Git-Traceability]]:每个 branch 必须包含 Jira ID 作为唯一标识
- [[Jira-Gate]]branch 创建前必须验证 Jira Task 存在
## Sources
- [[project-management-jira-workflow-steward]]