|
| 1 | +# 🌿 Git Branching Strategy |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +This document defines the branching strategy for the Python Learning Repository. |
| 6 | + |
| 7 | +--- |
| 8 | + |
| 9 | +## 📋 Branch Types |
| 10 | + |
| 11 | +### 1. **main** (Protected) |
| 12 | +- **Purpose:** Production-ready, stable code |
| 13 | +- **Status:** ✅ Exists |
| 14 | +- **Protection:** Always deployable, tested code only |
| 15 | +- **Direct Commits:** ❌ No (PRs only) |
| 16 | + |
| 17 | +### 2. **develop** (Primary Development) |
| 18 | +- **Purpose:** Integration branch for features |
| 19 | +- **Status:** ⚠️ Needs creation |
| 20 | +- **Protection:** Tested code before merging to main |
| 21 | +- **Direct Commits:** ❌ No (PRs required) |
| 22 | + |
| 23 | +### 3. **feature/** (New Features) |
| 24 | +- **Purpose:** Developing new features |
| 25 | +- **Pattern:** `feature/<description>` |
| 26 | +- **Examples:** |
| 27 | + - `feature/add-docker-support` |
| 28 | + - `feature/add-validation-utils` |
| 29 | + - `feature/add-examples-docs` |
| 30 | + |
| 31 | +### 4. **bugfix/** (Bug Fixes) |
| 32 | +- **Purpose:** Fixing bugs from issues |
| 33 | +- **Pattern:** `bugfix/<issue-number>-<description>` |
| 34 | +- **Examples:** |
| 35 | + - `bugfix/66-guess-number-validation` |
| 36 | + - `bugfix/67-rps-input-validation` |
| 37 | + - `bugfix/101-fastapi-datetime` |
| 38 | + |
| 39 | +### 5. **docs/** (Documentation) |
| 40 | +- **Purpose:** Documentation improvements |
| 41 | +- **Pattern:** `docs/<description>` |
| 42 | +- **Examples:** |
| 43 | + - `docs/add-troubleshooting-guide` |
| 44 | + - `docs/add-code-examples` |
| 45 | + - `docs/update-readme` |
| 46 | + |
| 47 | +### 6. **enhancement/** (Improvements) |
| 48 | +- **Purpose:** Code quality improvements |
| 49 | +- **Pattern:** `enhancement/<description>` |
| 50 | +- **Examples:** |
| 51 | + - `enhancement/add-type-hints` |
| 52 | + - `enhancement/add-docstrings` |
| 53 | + - `enhancement/optimize-algorithms` |
| 54 | + |
| 55 | +### 7. **release/** (Release Preparation) |
| 56 | +- **Purpose:** Preparing releases |
| 57 | +- **Pattern:** `release/v<major>.<minor>.<patch>` |
| 58 | +- **Examples:** |
| 59 | + - `release/v1.0.0` |
| 60 | + - `release/v1.1.0` |
| 61 | + |
| 62 | +### 8. **hotfix/** (Critical Fixes) |
| 63 | +- **Purpose:** Urgent production fixes |
| 64 | +- **Pattern:** `hotfix/<description>` |
| 65 | +- **Examples:** |
| 66 | + - `hotfix/security-path-traversal` |
| 67 | + - `hotfix/critical-data-loss` |
| 68 | + |
| 69 | +### 9. **experiment/** (Learning/Testing) |
| 70 | +- **Purpose:** Experimental features, learning |
| 71 | +- **Pattern:** `experiment/<description>` |
| 72 | +- **Examples:** |
| 73 | + - `experiment/add-gui-examples` |
| 74 | + - `experiment/add-async-examples` |
| 75 | + |
| 76 | +--- |
| 77 | + |
| 78 | +## 🔄 Branch Workflow |
| 79 | + |
| 80 | +```mermaid |
| 81 | +graph LR |
| 82 | + main --> develop |
| 83 | + develop --> feature |
| 84 | + develop --> bugfix |
| 85 | + develop --> docs |
| 86 | + develop --> enhancement |
| 87 | + feature --> develop |
| 88 | + bugfix --> develop |
| 89 | + docs --> develop |
| 90 | + enhancement --> develop |
| 91 | + develop --> release |
| 92 | + release --> main |
| 93 | + main --> hotfix |
| 94 | + hotfix --> main |
| 95 | + hotfix --> develop |
| 96 | +``` |
| 97 | + |
| 98 | +--- |
| 99 | + |
| 100 | +## 📝 Branch Naming Conventions |
| 101 | + |
| 102 | +| Type | Pattern | Example | |
| 103 | +|------|---------|---------| |
| 104 | +| Feature | `feature/<kebab-case>` | `feature/add-docker-support` | |
| 105 | +| Bugfix | `bugfix/<issue>-<desc>` | `bugfix/66-input-validation` | |
| 106 | +| Documentation | `docs/<kebab-case>` | `docs/add-examples` | |
| 107 | +| Enhancement | `enhancement/<kebab-case>` | `enhancement/type-hints` | |
| 108 | +| Release | `release/v<major>.<minor>` | `release/v1.0.0` | |
| 109 | +| Hotfix | `hotfix/<kebab-case>` | `hotfix/security-fix` | |
| 110 | +| Experiment | `experiment/<kebab-case>` | `experiment/gui-examples` | |
| 111 | + |
| 112 | +--- |
| 113 | + |
| 114 | +## 🚀 Creating Branches |
| 115 | + |
| 116 | +### From Issue |
| 117 | + |
| 118 | +```bash |
| 119 | +# For feature from issue #100 |
| 120 | +git checkout develop |
| 121 | +git pull origin develop |
| 122 | +git checkout -b feature/100-add-validation-utils |
| 123 | + |
| 124 | +# For bugfix from issue #66 |
| 125 | +git checkout develop |
| 126 | +git pull origin develop |
| 127 | +git checkout -b bugfix/66-guess-number-validation |
| 128 | +``` |
| 129 | + |
| 130 | +### For Documentation |
| 131 | + |
| 132 | +```bash |
| 133 | +git checkout develop |
| 134 | +git pull origin develop |
| 135 | +git checkout -b docs/add-troubleshooting-guide |
| 136 | +``` |
| 137 | + |
| 138 | +--- |
| 139 | + |
| 140 | +## ✅ Merge Requirements |
| 141 | + |
| 142 | +### All Branches → develop/main |
| 143 | + |
| 144 | +- [ ] Code compiles without errors |
| 145 | +- [ ] Tests pass (if applicable) |
| 146 | +- [ ] No security vulnerabilities introduced |
| 147 | +- [ ] Documentation updated (if needed) |
| 148 | +- [ ] Issue referenced in commit message |
| 149 | +- [ ] Code reviewed (for PRs) |
| 150 | + |
| 151 | +### Feature Branches |
| 152 | + |
| 153 | +- [ ] Feature complete |
| 154 | +- [ ] Examples added |
| 155 | +- [ ] README updated |
| 156 | + |
| 157 | +### Bugfix Branches |
| 158 | + |
| 159 | +- [ ] Bug reproduced and fixed |
| 160 | +- [ ] Test case added (if possible) |
| 161 | +- [ ] Issue number in commit |
| 162 | + |
| 163 | +### Documentation Branches |
| 164 | + |
| 165 | +- [ ] Spelling/grammar checked |
| 166 | +- [ ] Links verified |
| 167 | +- [ ] Examples tested |
| 168 | + |
| 169 | +--- |
| 170 | + |
| 171 | +## 📊 Branch Priority |
| 172 | + |
| 173 | +| Priority | Branch Type | Merge Target | |
| 174 | +|----------|-------------|--------------| |
| 175 | +| 🔴 Critical | hotfix/* | main immediately | |
| 176 | +| 🟡 High | bugfix/* | develop → main | |
| 177 | +| 🟢 Medium | feature/* | develop → main | |
| 178 | +| 🔵 Low | docs/*, enhancement/* | develop → main | |
| 179 | +| ⚪ Experimental | experiment/* | May not merge | |
| 180 | + |
| 181 | +--- |
| 182 | + |
| 183 | +## 🎯 Recommended Branches to Create |
| 184 | + |
| 185 | +### Immediate (Week 1) |
| 186 | + |
| 187 | +1. **develop** - Primary development branch |
| 188 | +2. **bugfix/66-guess-number-validation** - Fix input crash |
| 189 | +3. **bugfix/67-rps-input-validation** - Fix RPS crash |
| 190 | +4. **docs/add-troubleshooting-guide** - Add error guide |
| 191 | + |
| 192 | +### Short-term (Week 2-3) |
| 193 | + |
| 194 | +5. **enhancement/add-type-hints** - Add type hints |
| 195 | +6. **enhancement/add-docstrings** - Add documentation |
| 196 | +7. **feature/add-validation-utils** - Create utils module |
| 197 | +8. **feature/add-docker-support** - Docker configuration |
| 198 | + |
| 199 | +### Medium-term (Month 1-2) |
| 200 | + |
| 201 | +9. **feature/add-code-examples** - Examples for all concepts |
| 202 | +10. **feature/add-integration-tests** - Test suite |
| 203 | +11. **release/v1.0.0** - First stable release |
| 204 | + |
| 205 | +### Long-term (Month 3+) |
| 206 | + |
| 207 | +12. **experiment/add-gui-examples** - GUI learning |
| 208 | +13. **experiment/add-async-examples** - Async Python |
| 209 | +14. **feature/add-advanced-llm** - More LLM examples |
| 210 | + |
| 211 | +--- |
| 212 | + |
| 213 | +## 📁 Branch Protection Rules |
| 214 | + |
| 215 | +### main |
| 216 | +- [x] Require PR review |
| 217 | +- [ ] Require status checks (tests) |
| 218 | +- [ ] Require up-to-date branch |
| 219 | +- [x] Include administrators |
| 220 | + |
| 221 | +### develop |
| 222 | +- [ ] Require PR review |
| 223 | +- [ ] Require status checks |
| 224 | +- [ ] Allow direct commits from maintainers |
| 225 | + |
| 226 | +--- |
| 227 | + |
| 228 | +## 🔗 Related Documents |
| 229 | + |
| 230 | +- [CONTRIBUTING.md](CONTRIBUTING.md) |
| 231 | +- [PROJECT_REVIEW.md](PROJECT_REVIEW.md) |
| 232 | +- [GitHub Issues](https://github.com/hackdartstorm/Python/issues) |
| 233 | + |
| 234 | +--- |
| 235 | + |
| 236 | +**Status:** 📋 Strategy defined, branches pending creation |
| 237 | +**Last Updated:** February 19, 2026 |
0 commit comments