Git Visualizer: Interactive Canvas DAG for Version Control
Git Visualizer is an interactive learning tool that removes Git confusion by mapping commits, branch pointers, and HEAD movements on a directed acyclic graph (DAG), computed and rendered in real time on an HTML5 canvas.
# Graph Engine Capabilities
HTML5 Canvas Physics
Smooth frame loop rendering dynamic bezier curves, node pulses, and branch splits without DOM overhead.
True Git Object Representation
Treats commits as immutable snapshots with hash IDs, branch tags as pointer references, and HEAD as a symref.
Command State Machine
Parses simulated terminal commands (`commit`, `branch`, `checkout`, `merge`) with instant step rollback support.
# Graph Architecture & Mechanics
Most newcomers struggle with Git because they imagine files being pushed and pulled rather than a directed acyclic graph of immutable snapshots. Git Visualizer models the exact underlying data structures:
01.Immutable Commits & Dynamic Branch Pointers
When a user executes git commit, the state machine creates a new commit object containing a pseudo-SHA1 hash, commit message, and an array of parent node IDs.
- ▸Branch As Lightweight Pointers: The active branch tag (e.g.
mainorfeature) updates its reference pointer to the newly minted commit. - ▸HEAD Tracker: The HEAD label smoothly floats and locks onto the active branch pointer, visually explaining detached HEAD states when checked out directly to a hash.
02.Collision Avoidance & Bezier Branch Topologies
To prevent branches and merge lines from colliding as the graph grows, the canvas recalculates horizontal and vertical lane coordinates dynamically. Branch divergences use cubic bezier paths to smoothly separate child branches into isolated visual rows, rejoining cleanly during simulated merge commits with dual incoming parent vectors.