Why Branching Matters
Without ConTree, running the same operations twice (like installing packages, creating files, or compiling code) requires rebuilding the entire filesystem state from scratch each time. ConTree captures the exact filesystem state after each command, making it reproducible and allowing you to branch from that exact state.Simple Branching Example
This example demonstrates creating a parent state with a random value, then branching into multiple child states from that fixed parent:- Async
- Sync
run() for full API reference.- The
childstate contains a random value that would be different on each execution without ConTree - All three grandchildren start from the exact same
childstate (same random value) - Each grandchild branches independently, creating different execution paths
Advanced Branching Patterns
For more complex scenarios with multiple branching strategies:- Async
- Sync
ContreeImage for full API reference.Use Cases
Branching is particularly useful for:- Testing multiple scenarios: Run different operations from the same starting state
- Reproducible randomness: Capture random/non-deterministic operations and branch from them
- Parallel execution paths: Execute different workflows from a common checkpoint
- Version control for execution: Create branches like Git for different execution flows