|
| 1 | +# Fork Workflow Strategy: "The Integration Branch Pattern" |
| 2 | + |
| 3 | +This guide outlines the optimal workflow for maintaining a long-lived fork that consumes upstream updates while developing local features. |
| 4 | + |
| 5 | +## The Goal |
| 6 | +1. **Consume Upstream**: Get daily updates from `Dicklesworthstone/agentic_coding_flywheel_setup`. |
| 7 | +2. **Develop Locally**: Build new features in isolation. |
| 8 | +3. **Integrate**: Combine both sources into a stable deployment branch. |
| 9 | + |
| 10 | +## The "Integration Branch" Pattern |
| 11 | + |
| 12 | +We use a specific branching strategy to keep streams of work clean. |
| 13 | + |
| 14 | +### Branches |
| 15 | + |
| 16 | +| Branch Name | Role | Source of Truth | |
| 17 | +| :--- | :--- | :--- | |
| 18 | +| `main` | **Pure Upstream Mirror** | ONLY upstream code. Never commit here directly. | |
| 19 | +| `feature/*` | **Your Work** | Your isolated feature development. | |
| 20 | +| `local-desktop-installation-support` | **Integration / Deployment** | The "Production" branch for your local install. Contains Upstream + Your Features. | |
| 21 | + |
| 22 | +### Visual Data Flow |
| 23 | + |
| 24 | +```mermaid |
| 25 | +graph TD |
| 26 | + subgraph Upstream Repo |
| 27 | + U[Upstream / main] |
| 28 | + end |
| 29 | +
|
| 30 | + subgraph Your Fork |
| 31 | + M[main<br/>(Pure Copy)] |
| 32 | + F1[feature/my-cool-config] |
| 33 | + F2[feature/custom-scripts] |
| 34 | + I[local-desktop-installation-support<br/>(Integration Branch)] |
| 35 | + end |
| 36 | +
|
| 37 | + %% Flows |
| 38 | + U -->|Action: Daily Sync| I |
| 39 | + F1 -->|PR: Merge| I |
| 40 | + F2 -->|PR: Merge| I |
| 41 | + |
| 42 | + style I fill:#d4edda,stroke:#28a745,stroke-width:2px |
| 43 | + style U fill:#cce5ff,stroke:#004085,stroke-width:2px |
| 44 | +``` |
| 45 | + |
| 46 | +## Daily Protocol |
| 47 | + |
| 48 | +### 1. The Automated Morning Sync |
| 49 | +Your GitHub Action `upstream-sync.yml` runs daily. |
| 50 | +- It pulls `upstream/main`. |
| 51 | +- It attempts to merge into `local-desktop-installation-support`. |
| 52 | +- **If Clean**: It pushes automatically. You wake up to a fresh, up-to-date repo. |
| 53 | +- **If Conflict**: It opens a PR with conflict markers. You must resolve it (see [Upstream Sync Guide](./upstream-sync.md)). |
| 54 | + |
| 55 | +### 2. Developing a New Feature (The "Right Way") |
| 56 | + |
| 57 | +**NEVER** work directly on `local-desktop-installation-support`. Always use a feature branch. |
| 58 | + |
| 59 | +#### Step 1: Start Fresh |
| 60 | +Always branch off the latest integration branch. |
| 61 | +```bash |
| 62 | +git checkout local-desktop-installation-support |
| 63 | +git pull origin local-desktop-installation-support |
| 64 | +git checkout -b feature/my-new-idea |
| 65 | +``` |
| 66 | + |
| 67 | +#### Step 2: Hack & Commit |
| 68 | +Work as usual. |
| 69 | +```bash |
| 70 | +# code code code |
| 71 | +git add . |
| 72 | +git commit -m "Add my new idea" |
| 73 | +``` |
| 74 | + |
| 75 | +#### Step 3: Merge back to Integration |
| 76 | +When ready, merge your feature into the integration branch. |
| 77 | +```bash |
| 78 | +git checkout local-desktop-installation-support |
| 79 | +git merge feature/my-new-idea |
| 80 | +git push origin local-desktop-installation-support |
| 81 | +``` |
| 82 | +*Tip: If you want to use PRs for your own features to run tests, that's even better! Open a PR from `feature/my-new-idea` -> `local-desktop-installation-support`.* |
| 83 | + |
| 84 | +### 3. Handling Upstream "Gotchas" |
| 85 | + |
| 86 | +Sometimes upstream changes a file you also changed. |
| 87 | + |
| 88 | +1. **The Action fails to merge cleanly.** |
| 89 | +2. **You get a Notification.** |
| 90 | +3. **You Open the PR** created by the action. |
| 91 | +4. **You Resolve Conflicts** (locally or in UI) to decide: "Do I keep my custom config, or take their update?" |
| 92 | + |
| 93 | +## Summary Rules |
| 94 | + |
| 95 | +1. **Don't touch `main`**. Let the sync action handle upstream data. |
| 96 | +2. **Don't commit to `local-desktop-installation-support` directly** for big work. Use feature branches. |
| 97 | +3. **Treat `local-desktop-installation-support` as your "Personal Production"**. If it's in there, it's live on your machine. |
0 commit comments