Commit 1afcfaa
committed
Refactor stack management into forest command group with conflict-preserving rebase
This branch consolidates stack operations (split, merge, reroot) under a unified forest command group. Replaces separate consolidate/split commands with forest subcommands that provide better UX and enable conflict-preserving rebase workflows.
## Files Changed
### Added (14 files)
- `src/erk/cli/commands/forest/` - Forest command group (list, show, rename, split, merge, reroot operations)
- `src/erk/core/forest_ops.py` - Core forest operations (forest membership logic, tree queries)
- `src/erk/core/forest_types.py` - Forest dataclasses (ForestMetadata, Forest, ForestWorkTree)
- `src/erk/core/forest_utils.py` - Forest utilities (membership calculation, worktree grouping)
- `tests/commands/forest/` - Forest command tests (split, merge, reroot workflows)
- `tests/core/test_forest_*.py` - Forest operations tests
- `tests/fakes/forest_ops.py` - Fake forest operations for testing
### Deleted (4 files)
- `src/erk/cli/commands/consolidate.py` - Replaced by forest merge command
- `src/erk/cli/commands/split/` - Replaced by forest split command
- `tests/cli/commands/split/` - Test consolidation
### Modified (31 files)
- Git integrations (RealGit, NoopGit, PrintingGit) - New abstract methods for reroot
- CLI (cli.py) - Register forest group, remove old commands
- Create command - Auto forest lifecycle management
- Documentation (glossary.md, erk.md) - Forest terminology, updated references
## Key Changes
- **Forest command group**: Unified interface for split, merge, reroot, list, show, rename operations
- **Conflict-preserving rebase**: Reroot operation saves conflict states in git history with `[CONFLICT]` commit markers
- **Auto forest lifecycle**: Create command now auto-creates or joins forests based on Graphite parent/child relationships
- **Git layer enhancements**: 6 new abstract methods (rebase_branch, get_conflicted_files, commit_with_message, is_rebase_in_progress, abort_rebase, get_commit_sha)
- **Documentation**: Added forest glossary entries and updated integration examples
## Critical Notes
- Old consolidate/split commands removed; forest commands provide complete replacement
- Reroot requires Graphite enabled, clean working directory, and all branches to have worktrees
- Forest names are labels only - renaming never affects worktree paths1 parent 22a5776 commit 1afcfaa
File tree
83 files changed
+5122
-3410
lines changed- .claude/skills/erk/references
- docs/agent
- src/erk
- cli
- commands
- forest
- land_stack
- split
- shell_integration
- core
- git
- graphite
- tests
- cli/commands/split
- commands
- display/list
- forest
- graphite/land_stack
- land_stack
- sync
- workspace
- core
- foundation
- operations
- utils
- fakes
- integration
- shell
- unit
- commands
- status
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
83 files changed
+5122
-3410
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1127 | 1127 | | |
1128 | 1128 | | |
1129 | 1129 | | |
1130 | | - | |
| 1130 | + | |
1131 | 1131 | | |
1132 | 1132 | | |
1133 | 1133 | | |
| |||
1176 | 1176 | | |
1177 | 1177 | | |
1178 | 1178 | | |
1179 | | - | |
| 1179 | + | |
1180 | 1180 | | |
1181 | 1181 | | |
1182 | 1182 | | |
| |||
1189 | 1189 | | |
1190 | 1190 | | |
1191 | 1191 | | |
1192 | | - | |
| 1192 | + | |
1193 | 1193 | | |
1194 | 1194 | | |
1195 | 1195 | | |
| |||
1203 | 1203 | | |
1204 | 1204 | | |
1205 | 1205 | | |
1206 | | - | |
| 1206 | + | |
1207 | 1207 | | |
1208 | 1208 | | |
1209 | 1209 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
41 | 101 | | |
42 | 102 | | |
43 | 103 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
10 | 9 | | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | 19 | | |
21 | 20 | | |
22 | 21 | | |
| |||
37 | 36 | | |
38 | 37 | | |
39 | 38 | | |
40 | | - | |
41 | 39 | | |
42 | 40 | | |
43 | 41 | | |
44 | 42 | | |
45 | 43 | | |
| 44 | + | |
46 | 45 | | |
47 | 46 | | |
48 | 47 | | |
| |||
55 | 54 | | |
56 | 55 | | |
57 | 56 | | |
58 | | - | |
59 | 57 | | |
60 | 58 | | |
61 | 59 | | |
| |||
0 commit comments