Git Version Control
Interactive terminal for learning Git commands. Click buttons in the sidebar or type commands directly.
HTML
<terminal-window
id="terminal"
theme="dark"
prompt="~/project (main) $ "
cursor-style="block"
cursor-blink="true"
welcome="Git Tutorial - Type 'help' for available commands."
></terminal-window>
JavaScript
import { registerGitCommands } from './commands/git-commands.js';
const terminal = document.getElementById('terminal');
// Register all Git commands
registerGitCommands(terminal);
// Helper to run commands from buttons
function run(cmd) {
terminal.executeCommand(cmd);
}
Custom Command Example
// Simulated git status command
terminal.registerCommand('git', (args) => {
if (args[0] === 'status') {
return `On branch main
Your branch is up to date with 'origin/main'.
Changes not staged for commit:
modified: src/app.js
Untracked files:
README.md`;
}
});