feat: Add git-like diff and merge examples with professional color output #49
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds comprehensive examples demonstrating git-like tree diffing and merging workflows using
Prolly Trees, with professional color-coded terminal output for enhanced readability.
What's Added
🔍 Git Diff Example (examples/git_diff_example.rs)
🔀 Git Merge Example (examples/git_merge_example.rs)
🎨 Professional Terminal Output
🔧 Technical Features
Example Output
Diff Example
Git-like Tree Diffing Example
Creating main branch with initial data...
Main branch created with 5 files
Main tree hash: Some(ValueDigest([182, 243, 75, ...]))
Diff: main -> feature (shows what feature adds/changes)
Similar to: git diff main..feature
Changes: +0 files, -1 files, ~1 files modified
Merge Example
Scenario 3: Merge with conflicts
══════════════════════════════════════
Conflicts detected: 2 conflicts
Both modified: version.txt
Branch A: 1.1.0
Branch B: 1.0.1
Resolution: Using Branch A version
Conflicts resolved automatically!
🎯 Use Cases
Future Enhancements
Based on analysis, the core library could benefit from:
These examples demonstrate the foundation for such enhancements and provide a clear path forward for
integrating merge capabilities into the core Prolly Tree API.