How git-school/visualizing-git works
Project type and purpose
• Type: Static, front-end visualization tool (hosted on GitHub Pages)
• Purpose: Let users type Git commands, parse them in the browser, update an in-memory commit graph, and render it with D3.
File structure
• Top level: index.html (entry point), README, LICENSE
• css/: layout & styling (1140.css grid, normalize, project CSS, images)
• js/: core logic
• main.js – app bootstrap and wiring
• controlbox.js – command input UI and parser
• historyview.js – command-history panel
• explaingit.js – core Git interpreter & data-model logic
• demos.js – pre-loaded examples & scenarios
• vendor/: D3.js (and any other third-party libs)
• images/: UI assets and animations
• examples/: markdown docs for example scenarios
Pull additional insights from README
• Supports commands: branch, merge, rebase, cherry-pick, remote operations, etc.
• No server or API: everything runs in the browser
Main components
A. User Interface Layer
• History View Panel (historyview.js)
• Visualization Canvas (SVG injected by D3)
B. Application Logic
• Command Parser & Interpreter (explaingit.js)
• Demo & Example Loader (demos.js)
• State Manager / In-Memory Graph Model
C. Rendering Engine
• D3.js Library (js/vendor/)
• SVG Output in index.html
D. Static Assets
• CSS Stylesheets (css/)
• Images (images/)
• Examples Markdown (examples/)
E. Hosting / Deployment
• GitHub Pages (static file host – optional to show)
Relationships & data flow
1) User types “git …” into Command Input →
2) controlbox.js captures input →
3) explaingit.js parses + mutates the in-memory Git graph model →
4) historyview.js appends the command to the history pane →
5) main.js invokes D3.js to re-render the SVG graph based on updated model →
6) Visualization Canvas updates on screen
Architectural patterns & design principles
• MVC-style separation:
• View (HTML + CSS + D3 rendering)
• Controller (controlbox.js + main.js orchestrating events)
• Model (graph data structure in explaingit.js)
• Single-Page Application (all logic in browser)
• Plug-and-play demos: demo scenarios separated in demos.js
Technologies & libraries
• D3.js (data-driven docs)
• Vanilla JavaScript modules
• CSS Grid (1140.css) + normalize.css
• GitHub Pages (static hosting)