Overview
The Level Builder lets you create custom Git challenges and share them with others. You can design your own teaching scenarios, create practice exercises, or build puzzles for your team.Starting the Level Builder
To enter the level builder mode:Building a Level: Step-by-Step
The level builder follows a structured process to help you create complete, functional levels.Step 1: Create the Starting Repository
First, build the repository state that learners will start with:When you
define start, your command history is cleared. This prevents accidentally including setup commands in your solution.Step 2: Create the Solution
Now, from the starting state, execute the commands that solve the level:Step 3: Define the Goal
Once you’ve reached the desired end state, capture it:- The current repository state as the goal visualization
- Your command history as the solution
Step 4: Name Your Level
Give your level a descriptive name:Step 5: Add a Hint (Optional)
Provide a hint for learners who get stuck:Step 6: Create Introduction Dialog (Optional)
Add an instructional dialog that explains the level:- Add multiple dialog screens
- Include markdown-formatted instructions
- Add images or diagrams
- Provide context and learning objectives
Step 7: Export the Level
Finally, generate the JSON that defines your level:- Prompt for any missing information (name, hint, dialog)
- Generate a JSON blob representing your complete level
- Display the JSON in a modal window
Level Builder Commands Reference
Define Commands
View Commands
Dialog Commands
Completion
Utility
Sharing Your Level
Once you’ve finished building, you have several options for sharing:Option 1: Share the JSON Directly
- Copy the JSON output from the
finishcommand - Share it with others (via email, chat, etc.)
- They can import it using:
Option 2: Create a GitHub Gist
For easier sharing:- Copy the JSON output
- Create a new gist at gist.github.com
- Paste the JSON and save the gist
- Note the gist ID from the URL (e.g.,
a84407351f9c9f0cb241) - Share this URL with others:
Option 3: Submit to the Repository
If your level is particularly good, consider submitting it to be included in Learn Git Branching:- Copy your JSON output
- Open an issue or pull request
- Include your level JSON and explain what it teaches
Level JSON Structure
Your level is exported as JSON with this structure:- name: The level’s display name
- hint: Optional hint text
- startTree: JSON representing the starting repository state
- goalTreeString: JSON representing the target goal state
- solutionCommand: Semicolon-separated solution commands
- startDialog: Optional instructional dialog screens
Importing Levels
To try someone else’s custom level:Imported levels are temporary and won’t appear in the regular levels list. They’re perfect for one-off challenges or testing.
Examples of Custom Levels
Example 1: Simple Merge Exercise
Goal: Learn basic branch mergingExample 2: Complex Rebase Challenge
Goal: Practice interactive rebasingBest Practices
Troubleshooting
”Solution is empty” error
This means you tried todefine goal before executing any commands. Make sure to:
- Run
define startto set the starting point - Execute solution commands
- Then run
define goal
Lost your starting state
If you accidentally modify the starting state after defining it:Editing an existing level
You can edit a previously created level:Advanced Features
Disabled Commands
In your level JSON, you can disable specific Git commands to increase difficulty:Multiple Languages
You can add translations to make your level accessible to more learners:Next Steps
- Study existing levels in the source code for inspiration
- Share your levels using permalinks
- Join the community to get feedback on your level designs
- Contribute your best levels back to the project!