| name | git-workflow |
| description | Squad branching model: main-only workflow with feature branches |
| domain | version-control |
| confidence | high |
| source | team-decision |
Context
All feature work branches from main and PRs target main directly.
| Branch | Purpose |
|---|
main | Integration and release branch — all work lands here |
Branch Naming Convention
Issue branches MUST use: squad/{issue-number}-{kebab-case-slug}
Examples:
squad/195-fix-version-stamp-bug
squad/42-add-profile-api
Workflow for Issue Work
-
Branch from main:
git checkout main
git pull origin main
git checkout -b squad/{issue-number}-{slug}
-
Mark issue in-progress:
gh issue edit {number} --add-label "status:in-progress"
-
Create draft PR targeting main and assign Copilot for review:
gh pr create --base main --title "{description}" --body "Closes #{issue-number}" --draft --add-reviewer "@copilot"
All PRs route to Copilot for advisory review immediately upon creation.
-
Do the work. Make changes, write tests, commit with issue reference.
-
Push and mark ready:
git push -u origin squad/{issue-number}-{slug}
gh pr ready
-
After merge to main:
git checkout main
git pull origin main
git branch -d squad/{issue-number}-{slug}
git push origin --delete squad/{issue-number}-{slug}
Parallel Multi-Issue Work (Worktrees)
When the coordinator routes multiple issues simultaneously (e.g., "fix bugs X, Y, and Z"), use git worktree to give each agent an isolated working directory. No filesystem collisions, no branch-switching overhead.
When to Use Worktrees vs Sequential
| Scenario | Strategy |
|---|
| Single issue | Standard workflow above — no worktree needed |
| 2+ simultaneous issues in same repo | Worktrees — one per issue |
| Work spanning multiple repos | Separate clones as siblings (see Multi-Repo below) |
Setup
From the main clone:
git fetch origin main
git worktree add ../squad-195 -b squad/195-fix-stamp-bug origin/main
git worktree add ../squad-193 -b squad/193-refactor-loader origin/main
Naming convention: ../{repo-name}-{issue-number} (e.g., ../squad-195, ../squad-pr-42).
Each worktree:
- Has its own working directory and index
- Is on its own
squad/{issue-number}-{slug} branch from main
- Shares the same
.git object store (disk-efficient)
Per-Worktree Agent Workflow
Each agent operates inside its worktree exactly like the single-issue workflow:
cd ../squad-195
git add -A && git commit -m "fix: stamp bug (#195)"
git push -u origin squad/195-fix-stamp-bug
gh pr create --base main --title "fix: stamp bug" --body "Closes #195" --draft --add-reviewer "@copilot"
All PRs target main independently. Agents never interfere with each other's filesystem.
.squad/ State in Worktrees
The .squad/ directory exists in each worktree as a copy. This is safe because:
.gitattributes declares merge=union on append-only files (history.md, decisions.md, logs)
- Each agent appends to its own section; union merge reconciles on PR merge to main
- Rule: Never rewrite or reorder
.squad/ files in a worktree — append only
Cleanup After Merge
After a worktree's PR is merged to main:
git worktree remove ../squad-195
git worktree prune
git branch -d squad/195-fix-stamp-bug
git push origin --delete squad/195-fix-stamp-bug
If a worktree was deleted manually (rm -rf), git worktree prune recovers the state.
Multi-Repo Downstream Scenarios
When work spans multiple repositories (e.g., squad-cli changes need squad-sdk changes, or a user's app depends on squad):
Setup
Clone downstream repos as siblings to the main repo:
~/work/
squad-pr/ # main repo
squad-sdk/ # downstream dependency
user-app/ # consumer project
Each repo gets its own issue branch following its own naming convention. If the downstream repo also uses Squad conventions, use squad/{issue-number}-{slug}.
Coordinated PRs
Local Linking for Testing
Before pushing, verify cross-repo changes work together:
cd ../squad-sdk && npm link
cd ../squad-pr && npm link squad-sdk
cd ../squad-sdk && pip install -e .
Important: Remove local links before committing. npm link and go replace are dev-only — CI must use published packages or PR-specific refs.
Worktrees + Multi-Repo
These compose naturally. You can have:
- Multiple worktrees in the main repo (parallel issues)
- Separate clones for downstream repos
- Each combination operates independently
Anti-Patterns
- ❌ Non-conforming branch names (must be squad/{number}-{slug})
- ❌ Committing directly to main (use PRs)
- ❌ Switching branches in the main clone while worktrees are active (use worktrees instead)
- ❌ Using worktrees for cross-repo work (use separate clones)
- ❌ Leaving stale worktrees after PR merge (clean up immediately)
- ❌ Creating PRs without assigning Copilot for review (always add
--add-reviewer "@copilot")