Skip to content

Conversation

@schrockn
Copy link
Member

@schrockn schrockn commented Nov 18, 2025

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 paths

@schrockn schrockn force-pushed the forest-foundation branch 2 times, most recently from 68a098e to 1afcfaa Compare November 19, 2025 16:27
@schrockn schrockn changed the title Add forest system foundation and CLI infrastructure Refactor stack management into forest command group with conflict-preserving rebase Nov 19, 2025
…serving 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.

- `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

- `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

- 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

- **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

- 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 paths
@schrockn schrockn force-pushed the master branch 2 times, most recently from 8b6499b to 2a6500d Compare November 28, 2025 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants