docs: add branching strategy - one feature per branch
- Each phase gets its own branch - Branch from previous phase to inherit work - Rebase onto main before creating PR - Keeps history clean and reviews focused
This commit is contained in:
@@ -400,3 +400,100 @@ git rebase -i HEAD~2
|
||||
|
||||
If you're writing a commit message that says "fixed typo from previous commit", you should have rebased instead.
|
||||
|
||||
|
||||
---
|
||||
|
||||
## Part 6: Branching Strategy - One Feature Per Branch
|
||||
|
||||
### The Workflow
|
||||
|
||||
**Each phase/feature gets its own branch:**
|
||||
|
||||
```
|
||||
main
|
||||
└─ feature/03-design-polish (Phase 03)
|
||||
└─ feature/04-workout-modification (Phase 04, branched from 03)
|
||||
└─ feature/05-exercise-encyclopedia (Phase 05, branched from 04)
|
||||
```
|
||||
|
||||
### Step-by-Step
|
||||
|
||||
#### 1. Work on Phase 03
|
||||
```bash
|
||||
git checkout -b feature/03-design-polish
|
||||
# ... do all Phase 03 work ...
|
||||
# Multiple commits, testing, refinement
|
||||
git push origin feature/03-design-polish
|
||||
```
|
||||
|
||||
#### 2. When Phase 03 is Done → Create PR
|
||||
```bash
|
||||
# Create PR: feature/03-design-polish → main
|
||||
# Get code review, merge when approved
|
||||
# This becomes the baseline for Phase 04
|
||||
```
|
||||
|
||||
#### 3. Start Phase 04 (NEW BRANCH from Phase 03)
|
||||
```bash
|
||||
# First, make sure local is up-to-date
|
||||
git checkout feature/03-design-polish
|
||||
git pull origin feature/03-design-polish
|
||||
|
||||
# Create new branch FROM the current feature
|
||||
git checkout -b feature/04-workout-modification
|
||||
|
||||
# Now do all Phase 04 work on this new branch
|
||||
# ... commits for 04-01, 04-02, 04-03, etc ...
|
||||
git push origin feature/04-workout-modification
|
||||
```
|
||||
|
||||
#### 4. When Phase 04 is Done → Rebase Before PR
|
||||
```bash
|
||||
# Make sure feature/03 is merged to main
|
||||
git fetch origin
|
||||
|
||||
# Rebase Phase 04 onto main (to get clean history)
|
||||
git rebase origin/main feature/04-workout-modification
|
||||
|
||||
# Force-push (since we're rebasing)
|
||||
git push -f origin feature/04-workout-modification
|
||||
|
||||
# Create PR: feature/04-workout-modification → main
|
||||
```
|
||||
|
||||
### Why This Matters
|
||||
|
||||
- ✅ **Cleaner history** — Each phase is separate
|
||||
- ✅ **Easier reviews** — PRs are focused on one phase
|
||||
- ✅ **Better testing** — Each phase tested independently
|
||||
- ✅ **Easy rollback** — Remove one phase without touching others
|
||||
- ✅ **Work in parallel** — Different agents can work on different phases
|
||||
|
||||
### Current Situation
|
||||
|
||||
We've mixed Phase 03 and 04 in `feature/03-design-polish`. Going forward:
|
||||
|
||||
1. **Merge feature/03-design-polish → main** (code review, then merge)
|
||||
2. **Create feature/04-workout-modification** from main
|
||||
3. Move/cherry-pick Phase 04 commits to new branch (or just continue from here)
|
||||
4. **Create feature/05-exercise-encyclopedia** from feature/04 when 04 is done
|
||||
|
||||
### Rebase Chain Example
|
||||
|
||||
```bash
|
||||
# After 03 is merged and 04 starts:
|
||||
git checkout feature/04-workout-modification
|
||||
git rebase origin/main # Rebase 04 onto latest main
|
||||
|
||||
# After 04 is merged and 05 starts:
|
||||
git checkout feature/05-exercise-encyclopedia
|
||||
git rebase origin/main # Always rebase new features onto main
|
||||
```
|
||||
|
||||
### Rule of Thumb
|
||||
|
||||
- **One feature per branch**
|
||||
- **Each branch is independent**
|
||||
- **Rebase onto main before PR**
|
||||
- **No "feature/03-design-polish" commits after it's merged**
|
||||
|
||||
|
||||
Reference in New Issue
Block a user