|
| 1 | +# Branching Strategy |
| 2 | + |
| 3 | +Forest uses a minimal **master + next** branching strategy. |
| 4 | + |
| 5 | +## Branches |
| 6 | + |
| 7 | +### `master` |
| 8 | +- **Purpose:** Stable production releases |
| 9 | +- **Protected:** Yes (recommended) |
| 10 | +- **Commits:** Only via merge from `next` |
| 11 | +- **Tags:** All version tags (v0.1.0, v0.2.0, etc.) |
| 12 | + |
| 13 | +### `next` |
| 14 | +- **Purpose:** Integration and pre-release testing |
| 15 | +- **Protected:** Yes (recommended) |
| 16 | +- **Commits:** Feature branches merge here |
| 17 | +- **Stability:** Should be functional but may have rough edges |
| 18 | + |
| 19 | +### Feature Branches |
| 20 | +- **Naming:** `feature/description`, `fix/description`, `refactor/description` |
| 21 | +- **Created from:** `next` |
| 22 | +- **Merged to:** `next` |
| 23 | +- **Lifecycle:** Delete after merge |
| 24 | + |
| 25 | +## Workflow |
| 26 | + |
| 27 | +### Daily Development |
| 28 | + |
| 29 | +1. **Start new work:** |
| 30 | + ```bash |
| 31 | + git checkout next |
| 32 | + git pull origin next |
| 33 | + git checkout -b feature/your-feature-name |
| 34 | + ``` |
| 35 | + |
| 36 | +2. **Make changes, commit:** |
| 37 | + ```bash |
| 38 | + git add . |
| 39 | + git commit -m "Description of changes" |
| 40 | + ``` |
| 41 | + |
| 42 | +3. **Merge to next:** |
| 43 | + ```bash |
| 44 | + git checkout next |
| 45 | + git pull origin next |
| 46 | + git merge feature/your-feature-name |
| 47 | + git push origin next |
| 48 | + git branch -d feature/your-feature-name |
| 49 | + ``` |
| 50 | + |
| 51 | +### Release Process |
| 52 | + |
| 53 | +1. **Ensure next is stable:** |
| 54 | + ```bash |
| 55 | + git checkout next |
| 56 | + # Run tests, verify everything works |
| 57 | + npm run build |
| 58 | + npm run lint |
| 59 | + ``` |
| 60 | + |
| 61 | +2. **Merge next to master:** |
| 62 | + ```bash |
| 63 | + git checkout master |
| 64 | + git merge next |
| 65 | + ``` |
| 66 | + |
| 67 | +3. **Bump version:** |
| 68 | + ```bash |
| 69 | + # Update package.json and src/cli/commands/version.ts |
| 70 | + npm run build |
| 71 | + git add package.json src/cli/commands/version.ts |
| 72 | + git commit -m "Bump version to X.Y.Z" |
| 73 | + ``` |
| 74 | + |
| 75 | +4. **Tag release:** |
| 76 | + ```bash |
| 77 | + git tag -a vX.Y.Z -m "Release vX.Y.Z |
| 78 | +
|
| 79 | + - Feature 1 |
| 80 | + - Feature 2 |
| 81 | + - Fix 3" |
| 82 | + ``` |
| 83 | + |
| 84 | +5. **Push everything:** |
| 85 | + ```bash |
| 86 | + git push origin master --tags |
| 87 | + git checkout next |
| 88 | + git merge master # Keep next in sync |
| 89 | + git push origin next |
| 90 | + ``` |
| 91 | + |
| 92 | +## Quick Reference |
| 93 | + |
| 94 | +| Action | Command | |
| 95 | +|--------|---------| |
| 96 | +| Start feature | `git checkout -b feature/name next` | |
| 97 | +| Merge feature | `git checkout next && git merge feature/name` | |
| 98 | +| Release | `git checkout master && git merge next` | |
| 99 | +| Tag release | `git tag -a vX.Y.Z -m "..."` | |
| 100 | + |
| 101 | +## Branch Protection (Recommended) |
| 102 | + |
| 103 | +If using GitHub/GitLab, protect these branches: |
| 104 | + |
| 105 | +- **master:** Require pull request reviews, require status checks |
| 106 | +- **next:** Require status checks (optional: require reviews) |
| 107 | + |
| 108 | +## Examples |
| 109 | + |
| 110 | +### Adding a new feature: |
| 111 | +```bash |
| 112 | +git checkout next |
| 113 | +git pull origin next |
| 114 | +git checkout -b feature/add-search-filters |
| 115 | +# ... work on feature ... |
| 116 | +git commit -m "Add advanced search filters" |
| 117 | +git checkout next |
| 118 | +git merge feature/add-search-filters |
| 119 | +git push origin next |
| 120 | +git branch -d feature/add-search-filters |
| 121 | +``` |
| 122 | + |
| 123 | +### Releasing version 0.3.0: |
| 124 | +```bash |
| 125 | +git checkout next |
| 126 | +# ... verify next is stable ... |
| 127 | +git checkout master |
| 128 | +git merge next |
| 129 | +# Update version files |
| 130 | +npm run build |
| 131 | +git add package.json src/cli/commands/version.ts |
| 132 | +git commit -m "Bump version to 0.3.0" |
| 133 | +git tag -a v0.3.0 -m "Release v0.3.0" |
| 134 | +git push origin master --tags |
| 135 | +git checkout next |
| 136 | +git merge master |
| 137 | +git push origin next |
| 138 | +``` |
0 commit comments