Git simulation and visualization engine - dry run dangerous Git commands with visual feedback before executing
Project description
GitSim - Git Simulation & Visualization Engine
Dry-run dangerous Git commands with visual feedback before executing them.
GitSim is a sophisticated Git simulation tool that lets you preview the exact outcome of complex Git operationsโincluding conflict prediction, safety analysis, and visual before/after graphsโwithout touching your repository. Think of it as a "flight simulator" for Git commands.
๐ฏ Why GitSim?
The Problem: Git's most powerful commands (rebase, merge, reset, cherry-pick) are also its most dangerous. One wrong move can rewrite history, lose work, or create messy conflicts.
The Solution: GitSim simulates these operations in a safe, read-only environment, showing you:
- โ Exact outcome with before/after commit graphs
- โ Predicted conflicts with file-level details and certainty levels
- โ Safety ratings (LOW/MEDIUM/HIGH/CRITICAL danger levels)
- โ Recovery steps if something goes wrong
- โ Educational explanations of how Git commands work internally
Perfect for:
- ๐ Learning Git - See exactly how operations transform your repository
- ๐ผ Complex merges - Preview conflicts before starting a multi-hour merge
- ๐ง History rewriting - Safely plan rebases on shared branches
- ๐ฅ Team education - Teach Git workflows with visual demonstrations
- ๐ CI/CD safety - Validate Git operations in automation scripts
โก Quick Start
# Install from PyPI (v1.0.1)
pipx install gitsimulator
# All three commands work identically:
gitsim rebase main
git-sim rebase main
gitsimulator rebase main
# Preview a merge with conflict detection
gitsim merge feature-branch
# Learn how Git commands work
gitsim explain rebase
# Save repository state for experiments
gitsim snapshot create before-rebase
๐จ Features
๐ก๏ธ Core Simulation Commands
|
|
|
|
|
|
๐ Analysis & Visualization
-
Conflict Detection Engine
- CERTAIN conflicts: Same lines modified (90%+ accuracy)
- LIKELY conflicts: Nearby changes within 3 lines
- POSSIBLE conflicts: Same file modifications
- File-level granularity with line ranges
-
Safety Analysis System
- Danger Levels: LOW โ MEDIUM โ HIGH โ CRITICAL
- Reversibility: Can operation be undone?
- Force-push Required: Will remote history diverge?
- Data Loss Risk: Commits becoming unreachable?
- Recovery Suggestions: Step-by-step undo instructions
-
Visual Commit Graphs
- ASCII art graphs (matches
git log --graph) - Before/After comparisons side-by-side
- Branch topology visualization
- Highlighted commits and changes
- Color-coded output with Rich library
- ASCII art graphs (matches
๐ Educational Features
gitsim explain <command> - Interactive learning mode:
- ๐ Plain-English explanations of Git internals
- ๐ Step-by-step algorithm breakdowns
- โ ๏ธ Risk assessment and common pitfalls
- ๐ก Best practices and safety tips
- ๐ Alternative approaches
- ๐ Related commands and references
Supported explanations: rebase, merge, reset, cherry-pick, stash, tag
๐ง Advanced Tools
-
Snapshot System - Save/restore repository states
- Named snapshots with metadata
- HEAD position tracking
- Branch state preservation
- Timestamped history
- Quick rollback for experiments
-
Unified Simulator -
gitsim sim "any-git-command"- Natural syntax parsing
- All operations supported
- Consistent output format
-
Plugin Architecture
- Hook plugins (pre/post/override simulation)
- Custom simulators
- Output formatters
- Entry point discovery
-
Interactive TUI -
gitsim tui- Textual-powered interface
- Real-time command preview
- Headless mode for scripting
๐ฆ Installation
From PyPI (Recommended)
# Install with pipx (v1.0.1)
pipx install gitsimulator
# Or with pip
pip install gitsimulator
Note: All three commands work identically: gitsim, git-sim, and gitsimulator
From Source
git clone https://github.com/egekaya1/GitSimulator.git
cd GitSimulator
pip install -e ".[dev]"
Requirements
- Python: 3.11, 3.12, or 3.13
- OS: Linux, macOS, Windows
- Dependencies:
dulwich(Pure Python Git implementation)rich(Terminal formatting)typer(CLI framework)textual(TUI, optional)
๐ป Usage Examples
Rebase Simulation
$ gitsim rebase main
Simulating: git rebase main
โญโโโโโโโโโโ Rebase Summary โโโโโโโโโโโโฎ
โ Source branch feature โ
โ Target branch main โ
โ Merge base abc1234 โ
โ Commits to replay 3 โ
โ Predicted conflicts 1 โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โญโโโโโโโโโโ Safety Analysis โโโโโโโโโโโฎ
โ Danger Level ๐ด HIGH โ
โ Reversible Yes โ
โ Force Push Required Yes โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
Before Rebase:
* abc1234 (HEAD -> feature) Add authentication
* def5678 Update config
| * 123abcd (main) Fix security bug
|/
* 789xyz0 Initial commit
After Rebase (Simulated):
* new1234' (HEAD -> feature) Add authentication
* new5678' Update config
* 123abcd (main) Fix security bug
* 789xyz0 Initial commit
โ ๏ธ Found 1 CERTAIN conflict in config.py (lines 45-52)
Recovery: git reflog to restore, git reset --hard ORIG_HEAD
Merge with Conflict Prediction
$ gitsim merge feature-auth
โญโโโโโโโโโโโ Merge Summary โโโโโโโโโโโโฎ
โ Source branch feature-auth โ
โ Target branch main โ
โ Merge type Three-way โ
โ Files changed 8 โ
โ Conflicts 2 CERTAIN โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
Potential Conflicts
โโโโโโโโโโโโโโณโโโโโโโโโโโโโณโโโโโโโโโโโโ
โ Severity โ File โ Details โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ CERTAIN โ auth.py โ Lines โ
โ โ โ 23-45 โ
โ CERTAIN โ config.yml โ Lines โ
โ โ โ 12-18 โ
โโโโโโโโโโโโโโดโโโโโโโโโโโโโดโโโโโโโโโโโโ
Educational Mode
$ gitsim explain rebase
โญโโโโโโโโโโโโ git rebase โโโโโโโโโโโโโโฎ
โ Rebase re-applies commits from one โ
โ branch onto another, creating new โ
โ commits with different SHAs. โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
How it works:
1. Find merge base (common ancestor)
2. Save commits to replay
3. Reset HEAD to target branch
4. Apply each commit sequentially
5. Generate new SHAs for all commits
What changes:
โข All rebased commits get new SHAs
โข Commit timestamps updated
โข Linear history (no merge commits)
โข Parent references rewritten
Risks:
โ ๏ธ HISTORY REWRITE - Collaborators affected
โ ๏ธ FORCE PUSH REQUIRED - Remote diverges
โ ๏ธ CONFLICTS - May repeat for each commit
Safety tips:
โ Never rebase public/shared branches
โ Create backup: git branch backup-mybranch
โ Use git reflog to recover mistakes
Alternatives:
โข git merge - Preserves history
โข git cherry-pick - Pick specific commits
๐๏ธ Architecture & Technical Details
System Design
GitSim follows a clean, modular architecture with strict separation of concerns:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ CLI Layer (Typer) โ
โ โโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโ โ
โ โ Commands โ Options โ Parsing โ User Interface โ โ
โ โโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Simulation Dispatcher โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โข Command routing โ โ
โ โ โข Plugin hook execution (pre/override/post) โ โ
โ โ โข Result validation โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโ
โผ โผ โผ
โโโโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโโโ
โ Rebase โ โ Merge โ โ Reset โ
โSimulatorโ โSimulatorโ โSimulatorโ
โโโโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโโโ
โ โ โ
โโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Core Services โ
โ โโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโ โ
โ โ Repository โ Diff โ Conflict โ โ
โ โ (Dulwich) โ Analyzer โ Detector โ โ
โ โโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Git Repository (.git/) โ
โ (Read-only access via Dulwich) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Core Components
1. Repository Layer (core/repository.py)
Pure Python Git access via Dulwich - no git binary required:
class Repository:
"""Read-only Git repository wrapper."""
def get_commit(self, ref_or_sha: str) -> CommitInfo:
"""Resolve refs/SHAs to commits (supports short SHAs)."""
def walk_commits(self, include: list[str], exclude: list[str] | None) -> Iterator[CommitInfo]:
"""Topological commit traversal."""
def get_commit_changes(self, sha: str) -> list[FileChange]:
"""Extract file changes from commit."""
def build_graph(self, refs: list[str], max_commits: int) -> CommitGraph:
"""Build DAG representation."""
Key features:
- Short SHA resolution (7+ characters with ambiguity detection)
- Relative ref support (
HEAD~2,main^) - Topological sorting for graph display
- Lazy loading for performance
2. Simulation Engines (simulation/)
Each simulator implements BaseSimulator[T] protocol:
class BaseSimulator(Protocol[T]):
def validate(self) -> tuple[list[str], list[str]]:
"""Pre-flight checks โ (errors, warnings)."""
def simulate(self) -> T:
"""Execute simulation โ typed result."""
Rebase Simulator (simulation/rebase.py):
- Algorithm: Find merge base โ collect commits โ replay onto target
- Conflict detection: Compare each commit's changes against target
- SHA generation: Deterministic fake SHAs for visualization
- Step tracking: Detailed operation steps with conflicts
Merge Simulator (simulation/merge.py):
- Three-way merge analysis (base vs ours vs theirs)
- Fast-forward detection
- Merge commit synthesis
- Conflict accumulation across all files
Reset Simulator (simulation/reset.py):
- Mode handling: SOFT (staged only), MIXED (unstaged), HARD (discarded)
- Detached commit tracking
- Working directory simulation
- Reflog recovery instructions
Cherry-Pick Simulator (simulation/cherry_pick.py):
- Sequential commit application
- Cumulative conflict detection
- Parent relationship preservation
- Merge commit warnings
3. Conflict Detection (simulation/conflict_detector.py)
Sophisticated heuristics engine with three certainty levels:
class ConflictDetector:
def detect_conflicts(
self,
our_changes: list[FileChange],
their_changes: list[FileChange],
) -> list[ConflictInfo]:
"""Multi-level conflict analysis."""
Detection Strategy:
-
CERTAIN (90%+ accuracy):
- Same file, overlapping line ranges
- Both sides modify identical lines
- Binary file conflicts
-
LIKELY (70%+ accuracy):
- Changes within 3 lines of each other
- Same function/class modifications
- High churn areas
-
POSSIBLE (50%+ accuracy):
- Same file modified
- Different sections
- Semantic conflicts (imports, etc.)
Algorithm:
for each file changed in OURS:
if file changed in THEIRS:
parse diff hunks
for each hunk_ours:
for each hunk_theirs:
if hunks_overlap(hunk_ours, hunk_theirs):
โ CERTAIN conflict
elif hunks_nearby(hunk_ours, hunk_theirs, threshold=3):
โ LIKELY conflict
else:
โ POSSIBLE conflict
4. Data Models (core/models.py)
Type-safe data classes (Python 3.11+ dataclasses):
@dataclass
class SimulationResult:
"""Unified result type for all simulations."""
operation_type: OperationType
success: bool
before_graph: CommitGraph
after_graph: CommitGraph
conflicts: list[ConflictInfo]
warnings: list[str]
safety_info: SafetyInfo
changed_files: list[FileChange]
@dataclass
class CommitGraph:
"""DAG representation with branch topology."""
commits: dict[str, CommitInfo]
edges: list[tuple[str, str]] # (child, parent)
branch_tips: dict[str, str] # branch โ SHA
head_sha: str
@dataclass
class ConflictInfo:
"""Detailed conflict information."""
severity: ConflictSeverity # CERTAIN | LIKELY | POSSIBLE
file_path: str
description: str
our_lines: tuple[int, int] | None
their_lines: tuple[int, int] | None
5. Plugin System (plugins/)
Extensible architecture with three plugin types:
class HookPlugin(Plugin):
"""Intercept simulation lifecycle."""
def pre_simulate(self, repo, command, **kwargs) -> dict:
"""Modify inputs before simulation."""
def override_simulation(self, repo, command, **kwargs) -> SimulationResult | None:
"""Replace simulation entirely (or None to continue)."""
def post_simulate(self, repo, command, result) -> SimulationResult:
"""Modify results after simulation."""
class SimulatorPlugin(Plugin):
"""Add new simulation commands."""
def supports(self, command: str) -> bool:
"""Can this plugin handle the command?"""
def simulate(self, **kwargs) -> SimulationResult:
"""Execute custom simulation."""
class FormatterPlugin(Plugin):
"""Custom output formatting."""
def format_result(self, result: SimulationResult) -> str:
"""Render simulation result."""
Discovery: Entry points in pyproject.toml:
[project.entry-points."git_sim.plugins"]
my_plugin = "my_package.plugin:MyPlugin"
Performance Optimizations
- Lazy Graph Building: Only load commits needed for visualization
- Diff Caching: Memoize expensive diff operations
- Short SHA Indexing: Stop at first unique match
- Parallel-Safe: Pure functional core, no shared state
- Memory Efficient: Stream commits vs loading entire history
Testing Strategy
135 tests covering:
- Unit tests: Each component in isolation
- Integration tests: End-to-end command flows
- Property tests: Invariant checking (graphs are DAGs, etc.)
- Fixture-based: Multiple repo states (linear, branched, merge commits)
pytest --cov=git_sim --cov-report=html
# Current: 95%+ coverage
๐ Security & Safety
Read-Only Guarantee
GitSim never writes to your repository:
- Uses Dulwich's read-only API
- No
gitsubprocess calls that modify state - Simulations run entirely in memory
- Snapshot system uses separate
.git/git-sim-snapshots/directory
Plugin Safety
- Plugins run in same process (trust required)
- Hook plugins can modify simulation behavior
- Override plugins can replace entire simulations
- See
SECURITY.mdfor plugin security considerations
๐ Comparison with Alternatives
| Feature | GitSim | git log --graph |
GitKraken | lazygit | tig |
|---|---|---|---|---|---|
| Simulation | โ Full | โ No | โ No | โ No | โ No |
| Conflict Prediction | โ 3 levels | โ No | โ ๏ธ Basic | โ No | โ No |
| Safety Analysis | โ Yes | โ No | โ No | โ No | โ No |
| Educational Mode | โ Yes | โ No | โ No | โ No | โ No |
| Terminal UI | โ Yes | โ Yes | โ GUI only | โ Yes | โ Yes |
| No Git Binary | โ Pure Python | โ Requires Git | โ Requires Git | โ Requires Git | โ Requires Git |
| Snapshot System | โ Yes | โ No | โ ๏ธ Via GUI | โ No | โ No |
| Plugin System | โ Yes | โ No | โ Yes | โ No | โ No |
| SSH-Friendly | โ Yes | โ Yes | โ No | โ Yes | โ Yes |
| Price | โ Free | โ Free | ๐ฐ Paid | โ Free | โ Free |
GitSim's Unique Value: Only tool combining safe simulation + conflict prediction + education + beautiful CLI.
๐ ๏ธ Development
Setup
git clone https://github.com/egekaya1/GitSimulator.git
cd GitSimulator
python -m venv .venv
source .venv/bin/activate # or `.venv\Scripts\activate` on Windows
pip install -e ".[dev]"
Testing
# Run all tests
pytest
# With coverage
pytest --cov=git_sim --cov-report=html
# Specific test file
pytest tests/test_rebase.py
# Watch mode
pytest-watch
Code Quality
# Type checking
mypy src/git_sim --ignore-missing-imports
# Linting
ruff check src/git_sim tests
# Formatting
ruff format src/git_sim tests
# All checks (what CI runs)
ruff check src/git_sim tests && \
ruff format --check src/git_sim tests && \
mypy src/git_sim --ignore-missing-imports && \
pytest --cov=git_sim
Project Structure
GitSimulator/
โโโ src/git_sim/ # Source code
โ โโโ cli/ # Command-line interface
โ โ โโโ main.py # Typer app entry point
โ โ โโโ commands/ # Command implementations
โ โ โ โโโ rebase.py
โ โ โ โโโ merge.py
โ โ โ โโโ ...
โ โ โโโ formatters/ # Output rendering
โ โ โโโ graph.py # Commit graph ASCII art
โ โ โโโ conflict.py # Conflict tables
โ โ โโโ diff.py # Diff visualization
โ โโโ core/ # Core business logic
โ โ โโโ repository.py # Dulwich wrapper
โ โ โโโ models.py # Data classes
โ โ โโโ diff_analyzer.py # Diff parsing
โ โ โโโ exceptions.py # Custom errors
โ โโโ simulation/ # Simulation engines
โ โ โโโ base.py # Abstract base
โ โ โโโ dispatcher.py # Command routing
โ โ โโโ rebase.py # Rebase logic
โ โ โโโ merge.py # Merge logic
โ โ โโโ reset.py # Reset logic
โ โ โโโ cherry_pick.py # Cherry-pick logic
โ โ โโโ conflict_detector.py # Conflict heuristics
โ โ โโโ explain.py # Educational content
โ โโโ tui/ # Terminal UI
โ โ โโโ app.py # Textual application
โ โโโ plugins/ # Plugin system
โ โ โโโ base.py # Plugin protocols
โ โ โโโ loader.py # Discovery & loading
โ โโโ snapshot.py # State management
โโโ tests/ # Test suite (135 tests)
โ โโโ conftest.py # Pytest fixtures
โ โโโ test_rebase.py
โ โโโ test_merge.py
โ โโโ test_conflict_detection.py
โ โโโ ...
โโโ .github/workflows/ # CI/CD
โ โโโ ci.yml # Automated testing & publishing
โโโ pyproject.toml # Package metadata
โโโ README.md # This file
โโโ CHANGELOG.md # Version history
โโโ CONTRIBUTING.md # Development guide
โโโ SECURITY.md # Security policy
โโโ LICENSE.md # MIT license
๐ License
MIT License - see LICENSE.md
๐ Acknowledgments
Built with these excellent libraries:
- Dulwich - Pure Python Git implementation
- Rich - Beautiful terminal formatting
- Typer - CLI framework
- Textual - TUI framework
๐ Support & Contributing
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Contributing: See CONTRIBUTING.md
- Security: See SECURITY.md
โญ Star us on GitHub if GitSim helps you!
Installation
# From PyPI (v1.0.1)
pipx install gitsimulator
# Or with pip
pip install gitsimulator
# For development
git clone https://github.com/egekaya1/GitSim.git
cd GitSim
pip install -e .
Note: All three commands work identically: gitsim, git-sim, and gitsimulator
Usage
Simulate a Rebase
git-sim rebase main # Simulate rebasing onto main
git-sim rebase main --source feature # Specify source branch
git-sim rebase main --verbose # Show detailed conflict info
git-sim rebase main --execute # Execute after confirmation
Simulate a Merge
git-sim merge feature # Simulate merging feature
git-sim merge feature --no-ff # Force merge commit
Simulate a Reset
git-sim reset HEAD~2 --soft # Keep changes staged
git-sim reset HEAD~2 # Unstage changes (mixed)
git-sim reset HEAD~2 --hard # Discard all changes
Simulate Cherry-Pick
git-sim cherry-pick abc123 # Pick single commit
git-sim cherry-pick abc123 def456 # Pick multiple commits
Unified Simulation Command
git-sim sim "rebase main"
git-sim sim "merge feature"
git-sim sim "reset --hard HEAD~2"
git-sim sim "cherry-pick abc123"
Educational Features
git-sim explain rebase # Learn how rebase works
git-sim explain merge # Learn how merge works
git-sim explain reset # Learn about reset modes
git-sim explain cherry-pick # Learn about cherry-pick
Snapshot System
git-sim snapshot create "before-rebase" # Save current state
git-sim snapshot list # List all snapshots
git-sim snapshot restore "before-rebase"# Restore to snapshot
git-sim snapshot delete "before-rebase" # Delete snapshot
Other Commands
git-sim status # Show repository status
git-sim log # Show commit graph
git-sim diff HEAD~1 # Show commit diff
Example Output
Simulating: git rebase main
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Rebase Summary โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Source branch feature โ
โ Target branch main โ
โ Merge base abc1234 โ
โ Commits to replay 3 โ
โ Predicted conflicts 1 โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Safety Analysis โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Danger Level ๐ด HIGH โ
โ Reversible Yes โ
โ Force Push Required Yes โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Before Rebase:
* abc1234 (HEAD -> feature) Add new feature
* def5678 Update config
| * 123abcd (main) Fix bug
|/
* 789xyz0 Initial commit
After Rebase (Simulated):
* new1234 (HEAD -> feature) Add new feature
* new5678 Update config
* 123abcd (main) Fix bug
* 789xyz0 Initial commit
โ ๏ธ Found 1 potential conflict(s)
CERTAIN: Lines 10-15 in 'config.py' modified differently on both sides
Development
pip install -e ".[dev]" # Install dev dependencies
pytest # Run tests
pytest --cov=git_sim # Run with coverage
mypy src/git_sim --ignore-missing-imports # Type check
ruff check src/git_sim # Lint
ruff format --check src/git_sim # Format check
Project Structure
git-sim/
โโโ src/git_sim/
โ โโโ cli/ # CLI commands and formatters
โ โ โโโ main.py # Typer app entry point
โ โ โโโ commands/ # Command implementations
โ โ โโโ formatters/ # Output formatters (graph, diff, conflict)
โ โโโ core/ # Core components
โ โ โโโ models.py # Data models (SimulationResult, CommitGraph, etc.)
โ โ โโโ repository.py # Git repository wrapper (Dulwich)
โ โ โโโ diff_analyzer.py # Diff parsing and analysis
โ โ โโโ exceptions.py # Custom exceptions
โ โโโ simulation/ # Simulation engines
โ โ โโโ dispatcher.py # Unified command dispatcher
โ โ โโโ base.py # Abstract base simulator
โ โ โโโ rebase.py # Rebase simulation
โ โ โโโ merge.py # Merge simulation
โ โ โโโ reset.py # Reset simulation
โ โ โโโ cherry_pick.py # Cherry-pick simulation
โ โ โโโ conflict_detector.py# Conflict detection heuristics
โ โ โโโ explain.py # Educational explanations
โ โโโ tui/ # Terminal UI (Textual)
โ โ โโโ app.py # Interactive TUI application
โ โโโ plugins/ # Plugin system
โ โ โโโ base.py # Plugin base classes
โ โ โโโ loader.py # Plugin discovery and loading
โ โโโ snapshot.py # Snapshot/restore functionality
โโโ tests/ # Test suite
โโโ .github/workflows/ # CI/CD pipeline
Key Concepts
SimulationResult
All simulators return a unified SimulationResult:
from git_sim.simulation import simulate
result = simulate("rebase", onto="main")
print(result.operation_type) # OperationType.REBASE
print(result.has_conflicts) # True/False
print(result.safety_info) # Safety analysis
Safety Levels
| Level | Description |
|---|---|
| LOW | Safe, easily reversible |
| MEDIUM | Potentially destructive but recoverable |
| HIGH | History rewrite, force-push risk |
| CRITICAL | Data loss risk |
Interactive TUI
git-sim tui # Launch interactive terminal UI
Plugin System
git-sim plugin list # List available plugins
git-sim plugin new my-plugin # Generate plugin template
git-sim plugin new my-hook --type hook # Generate hook plugin
git-sim plugin load my-plugin # Load a plugin
Roadmap
- Rebase simulation
- Merge simulation
- Reset simulation
- Cherry-pick simulation
- Unified dispatcher
- Safety analysis
- Educational mode (explain)
- Snapshot/restore
- Interactive TUI mode (Textual)
- Plugin system
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gitsimulator-1.0.7.tar.gz.
File metadata
- Download URL: gitsimulator-1.0.7.tar.gz
- Upload date:
- Size: 86.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
82a0a3725f495afbb58f4264866e8b4e44ddba58e4819da313ee09f335ae22bc
|
|
| MD5 |
47e4bb342f0f420063e0c900ef5c8f7c
|
|
| BLAKE2b-256 |
303215b31f39e23a571f0153338307c4e6e15770cf8b4f4e02ade9e8ceb7f3e1
|
Provenance
The following attestation bundles were made for gitsimulator-1.0.7.tar.gz:
Publisher:
ci.yml on egekaya1/GitSimulator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gitsimulator-1.0.7.tar.gz -
Subject digest:
82a0a3725f495afbb58f4264866e8b4e44ddba58e4819da313ee09f335ae22bc - Sigstore transparency entry: 716456192
- Sigstore integration time:
-
Permalink:
egekaya1/GitSimulator@1f291e593e9016f751555b08dbc80964f077eaa0 -
Branch / Tag:
refs/tags/v1.0.8 - Owner: https://github.com/egekaya1
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@1f291e593e9016f751555b08dbc80964f077eaa0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file gitsimulator-1.0.7-py3-none-any.whl.
File metadata
- Download URL: gitsimulator-1.0.7-py3-none-any.whl
- Upload date:
- Size: 74.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d69bb65355e51b86c203eb38696df8e917db6b4d6ad5158192fbfae461ff2ac
|
|
| MD5 |
edc30722517f392eb14ad9df7f3ba41e
|
|
| BLAKE2b-256 |
5a3a0af43bb4fab89b74698c7589a5641716c10a2aeca07a5237e7bbe4415ebb
|
Provenance
The following attestation bundles were made for gitsimulator-1.0.7-py3-none-any.whl:
Publisher:
ci.yml on egekaya1/GitSimulator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gitsimulator-1.0.7-py3-none-any.whl -
Subject digest:
0d69bb65355e51b86c203eb38696df8e917db6b4d6ad5158192fbfae461ff2ac - Sigstore transparency entry: 716456195
- Sigstore integration time:
-
Permalink:
egekaya1/GitSimulator@1f291e593e9016f751555b08dbc80964f077eaa0 -
Branch / Tag:
refs/tags/v1.0.8 - Owner: https://github.com/egekaya1
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@1f291e593e9016f751555b08dbc80964f077eaa0 -
Trigger Event:
push
-
Statement type: