Summary
Add first-class support for stacked branches (branch-from-branch development) inside aIDE's worktree system. This lets users keep shipping while PRs are under review by branching from in-flight feature branches instead of waiting for them to merge to main.
Background
This is a well-established workflow supported by tools like Graphite, ghstack, Git Town, and Sapling. The core idea:
- Branch B from branch A (your PR branch), not from
main
- Open PR(B) with
base=A
- Keep shipping while A is under review
- After A merges: rebase B onto
main, resolve conflicts once, continue
aIDE already has strong primitives for this via worktrees and base-branch creation in worktreeManager.ts and CreateWorktreeModal.tsx.
Proposed Feature (v1)
Core Capabilities
- "Create Child Branch" action from a worktree item
- Track parent/child relationships in local app state (not committed)
- "Sync Stack" command:
- Fetch + detect merged parents
- Auto-rebase children in order
- Pause on conflict with guided resolve UI
- Stack graph in Worktree panel (
A → B → C) with statuses:
- Ahead/behind, needs rebase, conflicted, merged parent
- Optional GitHub integration: create stacked PRs and auto-retarget base branches
Important Caveats
- This rewrites commit history (rebases) — educate users on force-push-to-feature-branch
- Never auto-rebase without opt-in + dry-run preview
- Conflict handling UX is the make-or-break piece
File Map
| File |
Action |
Description |
packages/shared/src/index.ts |
edit |
Add branch-stack types (node id, parent branch, sync status, conflict state) + IPC channels (STACK_LIST, STACK_CREATE_CHILD, STACK_SYNC, STACK_RETARGET) |
packages/main/src/workspace/worktreeManager.ts |
edit |
Add child-branch creation handler (base defaults to active branch) + stack-sync orchestration (ordered rebase pipeline, dry-run mode, conflict reporting) |
packages/main/src/git/branchStack.ts |
new |
Pure git operations: merge-base, rebase, ancestry checks, merged detection — separated from IPC/UI concerns |
packages/renderer/src/components/WorktreePanel/WorktreePanel.tsx |
edit |
Render parent/child indicators, "Create Child Branch" action, sync status badges, conflict CTAs |
packages/renderer/src/components/WorktreePanel/CreateWorktreeModal.tsx |
edit |
Add "Create as child of current branch" shortcut preset, preselect base branch to active worktree branch |
packages/renderer/src/hooks/useWorktrees.ts |
edit |
Subscribe to stack status updates, expose sync actions to UI |
Practical Workflow (Manual, Available Now)
- Build feature A on
feature/A
- While A in review, create
feature/B from feature/A in a separate worktree
- Open PR B with base branch =
feature/A
- Keep bugfixing A; periodically rebase
feature/B onto updated feature/A
- When A merges, rebase B onto
main, retarget PR B to main
Summary
Add first-class support for stacked branches (branch-from-branch development) inside aIDE's worktree system. This lets users keep shipping while PRs are under review by branching from in-flight feature branches instead of waiting for them to merge to main.
Background
This is a well-established workflow supported by tools like Graphite, ghstack, Git Town, and Sapling. The core idea:
mainbase=Amain, resolve conflicts once, continueaIDE already has strong primitives for this via worktrees and base-branch creation in
worktreeManager.tsandCreateWorktreeModal.tsx.Proposed Feature (v1)
Core Capabilities
A → B → C) with statuses:Important Caveats
File Map
packages/shared/src/index.tsSTACK_LIST,STACK_CREATE_CHILD,STACK_SYNC,STACK_RETARGET)packages/main/src/workspace/worktreeManager.tspackages/main/src/git/branchStack.tspackages/renderer/src/components/WorktreePanel/WorktreePanel.tsxpackages/renderer/src/components/WorktreePanel/CreateWorktreeModal.tsxpackages/renderer/src/hooks/useWorktrees.tsPractical Workflow (Manual, Available Now)
feature/Afeature/Bfromfeature/Ain a separate worktreefeature/Afeature/Bonto updatedfeature/Amain, retarget PR B tomain