Command System
Learn Git Branching provides an interactive command-line interface that simulates Git operations in a visual environment. The application supports multiple command types to help you learn and practice Git concepts.Command Categories
The command system is organized into several categories:Git Commands
Standard Git commands for version control operations
Mercurial Commands
Mercurial (hg) command support with Git translation
Special Commands
Learning-specific commands for levels and navigation
Command Processing
Commands go through a multi-stage processing pipeline:1. Shortcut Expansion
Shortcuts are expanded first to their full command equivalents:gc→git commitgo→git checkoutgb→git branchgr→git rebasegst,gs→git status
2. Instant Commands
Some commands execute immediately without parsing:git help- Display help informationshow commands- List all available commandsshow solution- Display the level solutionflip- Flip the tree visualization
3. Regular Parsing
Commands are parsed using regex patterns to:- Identify the command type (git, hg, sandbox, level)
- Extract options and flags (e.g.,
--amend,-b) - Parse arguments and validate syntax
4. Command Execution
After parsing, commands are executed through:- Direct execution for Git/Mercurial operations
- Delegation for commands that translate to other commands
- Animation queue for visual updates
Command Format
All commands follow standard Unix command-line conventions:Options
Options modify command behavior:Arguments
Arguments specify what to operate on:Golf Scoring
Some commands are excluded from “Golf Mode” scoring:git status- Informational onlygit log- Viewing historygit show- Inspecting commitsgit add- Staging simulationgit rev-list- Internal use
dontCountForGolf: true don’t count toward your move count in levels.
Error Handling
The command system provides helpful error messages:- GitError - Git-specific errors (e.g., branch doesn’t exist)
- CommandProcessError - Parsing or syntax errors
- CommandResult - Informational messages
- Warning - Non-fatal warnings
Command Reference Syntax
In this documentation:<required>- Required argument[optional]- Optional argument|- Alternative options...- Can be repeated
Getting Help
Use these commands to learn more:Next Steps
Git Commands
Learn all supported Git commands
Mercurial Commands
Use Mercurial instead of Git
Special Commands
Navigate levels and control the app