Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
6b54dac
refactor(merge): simplify multistack discovery logic
jonnii Apr 15, 2026
c79249b
feat(foreach): improve foreach action and add tests
jonnii Apr 15, 2026
7a118d4
feat(foreach): add foreach events and dry-run support
jonnii Apr 15, 2026
babce10
feat(foreach): add stack range filtering and parallel execution
jonnii Apr 15, 2026
b5cf0a3
feat(restack): improve restack with better CLI flags and add tests
jonnii Apr 15, 2026
b58d446
docs(cli): update stack-fix agent template
jonnii Apr 15, 2026
3f5b54c
include restack
jonnii Apr 15, 2026
81f3125
docs(cli): update stack-verify agent template
jonnii Apr 15, 2026
9d0f44b
docs(cli): update stack-absorb agent template
jonnii Apr 15, 2026
e1a6436
docs(cli): update stack-sync agent template
jonnii Apr 15, 2026
c3854c4
docs(cli): update stack-status agent template
jonnii Apr 15, 2026
d46049f
include fold
jonnii Apr 15, 2026
5d6224d
include stack reviwe
jonnii Apr 15, 2026
6781736
docs(cli): update skill templates to use scoped restack commands
jonnii Apr 15, 2026
cd75326
feat(sync): add would_restack_stacks to dry-run JSON for restack plan…
jonnii Apr 15, 2026
17e54f8
feat(foreach): add --all-stacks and --stacks multi-stack scope flags
jonnii Apr 15, 2026
437a000
feat(restack): add --parallel flag to run independent stacks in paral…
jonnii Apr 21, 2026
04cb108
feat(restack): annotate JSON output with stack_root per branch for mu…
jonnii Apr 21, 2026
e016443
docs: update restack examples to use scoped flags across user-facing …
jonnii Apr 21, 2026
0add0e0
fix: harden stack automation error handling
jonnii Apr 21, 2026
f2e58cd
docs: clarify would_restack_stacks must be recomputed after sync befo…
jonnii Apr 22, 2026
3ef4233
Consolidate stack [stack] (18 branches)
jonnii Apr 22, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .claude/rules/stackit-workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This project uses stackit for stacked changes. **NEVER use raw git commands for
| `git commit -m "..."` | `command stackit create -m "..."` |
| `git checkout -b` | `command stackit create -m "..."` |
| `gh pr create` | `command stackit submit` |
| `git rebase` | `command stackit restack` |
| `git rebase` | `command stackit restack --upstack` (or `--all-stacks`) |

**Exception:** `git commit` is allowed when adding commits to an existing stacked branch.

Expand Down Expand Up @@ -38,7 +38,7 @@ Use skills instead of manual commands:
| `/stack-status` | Check stack health |
| `/stack-fix` | Diagnose and fix issues |
| `/stack-sync` | Sync with trunk, cleanup merged branches |
| `/stack-restack` | Rebase all branches in stack |
| `/stack-restack` | Rebase branches (scoped, multi-stack, or parallel) |
| `/stack-tidy` | Clean up fixup/WIP commits across the stack |

Run `/stackit` for the full guide.
Expand All @@ -51,7 +51,7 @@ Run `/stackit` for the full guide.
| Empty branch created | You forgot to stage; delete branch and retry with staged changes |
| Using `git commit` for new branch | Use `stackit create` - it creates branch + commit together |
| Using `git checkout -b` | Use `stackit create` - branch name auto-generated from message |
| Manual rebase broke stack | Use `stackit restack` to safely rebase all children |
| Manual rebase broke stack | Use `stackit restack --upstack` to safely rebase children (or `--all-stacks` for all) |
| Using `gh pr create` | Use `stackit submit` - it handles stacked PR dependencies |
| Amending wrong commit | Use `stackit absorb` to auto-route changes to correct commits |
| Stack out of sync after merge | Run `stackit sync` to cleanup merged branches and update trunk |
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ command stackit submit
command stackit checkout <branch> # Go to branch with feedback
# Make changes...
command stackit modify # Amend commit
command stackit restack # Update children
command stackit restack --upstack # Update children of this branch
command stackit submit # Update PRs
```

Expand All @@ -67,7 +67,7 @@ command stackit submit # Update PRs
| Forgetting to stage | Always `git add -A` before `create` |
| Using `git commit` for new branch | Use `stackit create` instead |
| Using `git checkout -b` | Use `stackit create` instead |
| Manual rebase | Use `stackit restack` |
| Manual rebase | Use `stackit restack --upstack` (or `--all-stacks`) |
| Using `gh pr create` | Use `stackit submit` |

**Use `/stack-plan` when starting from scratch** to plan the stack structure before writing code.
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ Stackit includes specialized commands designed for Claude Code, providing intell
| `stack-create [branch-name]` | Create a new stacked branch with intelligent naming and commit messages | Adding a new feature branch to your stack |
| `stack-submit [--stack \| --draft]` | Submit branches as PRs with auto-generated descriptions | Creating or updating pull requests |
| `stack-sync` | Sync with trunk, cleanup merged branches, and restack | Keeping your stack up-to-date with main |
| `stack-restack` | Rebase all branches to ensure proper ancestry | Fixing branch relationships after changes |
| `stack-restack` | Rebase branches with scoped or multi-stack targeting | Fixing branch relationships after changes |
| `stack-absorb` | Intelligently absorb working changes into correct commits | Applying fixes across multiple stack branches, with conflict resolution guidance |
| `stack-fix` | Diagnose and fix common stack issues | Resolving compilation errors or structural problems |
| `stack-describe` | Generate or update stack description from changes | Documenting your stack for PRs |
Expand Down Expand Up @@ -272,9 +272,9 @@ stack-submit --stack # Creates/updates all PRs in the stack
| Command | Description |
|:---|:---|
| `stackit flatten` | Move branches closer to trunk where possible |
| `stackit restack` | Rebase all branches in the stack to ensure proper ancestry |
| `stackit restack` | Rebase branches to ensure proper ancestry (`--branch X --upstack`, `--all-stacks`, `--stacks root1,root2`, `--parallel`) |
| `stackit get [branch|PR]` | Sync a stack or specific PR from remote |
| `stackit foreach` | Run a shell command on each branch in the stack (default: upstack) |
| `stackit foreach` | Run a shell command on each branch (`--upstack`, `--all-stacks`, `--stacks`, `--parallel`) |
| `stackit submit` | Push branches and create/update GitHub PRs (alias: `ss` for `--stack`) |
| `stackit sync` | Pull trunk, delete merged branches, and restack |
| `stackit merge` | Interactive merge wizard (use `merge next` or `merge ship` for non-interactive) |
Expand Down Expand Up @@ -323,7 +323,7 @@ These flags are available on all `stackit` commands:
If you receive feedback on a branch in the middle of your stack:
1. `stackit checkout <branch>` to move to that branch.
2. Make your changes and run `stackit modify`.
3. Run `stackit restack` to update all child branches.
3. Run `stackit restack --upstack` to update child branches (or `--all-stacks` to cover every independent stack).
4. Run `stackit submit` to update the PRs on GitHub.

### Using `stackit absorb`
Expand Down Expand Up @@ -535,7 +535,7 @@ stackit track

### Merge conflicts during restack

When `stackit restack` encounters conflicts:
When `stackit restack` encounters conflicts (use `--continue-on-conflict` to skip conflicted stacks and keep going):

1. Resolve the conflicts in your editor
2. Stage the resolved files: `git add .`
Expand Down
2 changes: 1 addition & 1 deletion doc/src/cli/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Manage your entire stack.
- $$stackit submit$$ - Create/update PRs
- $$stackit sync$$ - Update from trunk
- $$stackit merge$$ - Merge your stack
- $$stackit restack$$ - Rebase all branches
- $$stackit restack$$ - Rebase branches (scoped with `--upstack`, `--all-stacks`, `--parallel`)
- $$stackit flatten$$ - Optimize stack structure

### Worktrees
Expand Down
6 changes: 4 additions & 2 deletions doc/src/guide/concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,12 @@ stackit untrack
When you modify a branch in the middle of a stack, all child branches need to be rebased. This is called **restacking**.

```bash
stackit restack
stackit restack --upstack # Restack current branch and descendants
stackit restack --all-stacks # Restack every independent stack
stackit restack --all-stacks --parallel # Same, but in parallel worktrees
```

Stackit automatically rebases all affected branches to maintain the stack structure.
Stackit rebases the affected branches to maintain the stack structure. Use `--branch <name>` to target a specific branch without checking it out first.

## Metadata

Expand Down
2 changes: 1 addition & 1 deletion doc/src/start/submit.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ After making changes to your stack:

2. Restack child branches:
```bash
stackit restack
stackit restack --upstack
```

3. Update the PRs:
Expand Down
4 changes: 2 additions & 2 deletions doc/src/workflows/daily.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ When you receive feedback on a branch in the middle of your stack:
stackit modify
```

3. Update all child branches:
3. Update child branches:
```bash
stackit restack
stackit restack --upstack
```

4. Update the PRs:
Expand Down
2 changes: 1 addition & 1 deletion doc/src/workflows/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Practical guides for using stackit effectively in your daily development.

| Task | Command |
|------|---------|
| Update after code review | `stackit modify` then `stackit restack` |
| Update after code review | `stackit modify` then `stackit restack --upstack` |
| Absorb fixes into correct branches | `stackit absorb` |
| Sync with main | `stackit sync` |
| Split commits into branches | `stackit split` |
Expand Down
1 change: 1 addition & 0 deletions internal/actions/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ type RestackProgress struct {
Reparented bool // true if the branch was reparented
OldParent string // the old parent name if reparented
NewParent string // the new parent name if reparented
StackRoot string // independent stack root (set by multi-stack callers; empty for single-stack)
}

// RestackProgressCallback is called for each branch during restack with a
Expand Down
1 change: 1 addition & 0 deletions internal/actions/foreach/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func (CompletionEvent) foreachEvent() {}
type BranchResult struct {
BranchName string
Status BranchStatus
ExitCode int
Output string
Error error
}
Expand Down
Loading
Loading