Overview
Learn Git Branching allows you to share permalinks - special URLs that encode Git commands or repository states. This makes it easy to share examples, demonstrations, or specific scenarios with others.Why Use Permalinks?
Permalinks are useful for:- Teaching: Share specific Git scenarios with students
- Documentation: Embed interactive examples in tutorials
- Debugging: Share a problematic repository state for help
- Demonstrations: Show Git concepts in presentations
- Collaboration: Share interesting Git puzzles with your team
Types of Permalinks
Learn Git Branching supports several types of permalink parameters.Command Parameter
Execute arbitrary commands when the page loads using thecommand URL parameter.
Basic Usage
- Load the application
- Automatically execute
git commit; git commit - Display the resulting repository state
Creating Command URLs
To create a command URL:- Use the
commandparameter - URL-encode your commands (spaces become
%20, semicolons separate commands) - Optionally add
NODEMOto skip the intro dialog
Complete Example
Share Permalink Command
Generate a permalink for the current repository state:importTreeNow command.
Example output:
The
share permalink command exports your entire repository structure as JSON, then encodes it in the URL. The URLs can be quite long for complex repositories.Level Parameter
Link directly to a specific level:?level=intro1- Introduction to Git Commits?level=intro2- Branching in Git?level=rampup1- Detach yo’ HEAD?level=remote1- Clone Intro
Gist Level ID
Share custom levels using GitHub Gists:Demo Parameters
Several demo modes showcase specific features:Standard Demo
Remote Demo
NODEMO Parameter
Skip the introductory dialog and go straight to the sandbox:Locale Parameter
Set the interface language:en_US- Englishes_AR,es_MX,es_ES- Spanish variantszh_CN,zh_TW- Chinese variantsja- Japanesede_DE- Germanfr_FR- Frenchko- Koreanru_RU- Russian- And many more!
Combining Parameters
You can combine multiple parameters in one URL:- Skips the intro dialog (
NODEMO) - Sets Japanese language (
locale=ja) - Executes two commands (
command=...)
Parameters are separated by
& in the URL. The first parameter uses ?, subsequent ones use &.Practical Examples
Example 1: Teaching Branch Management
Create a scenario showing a feature branch workflow:Example 2: Demonstrating Rebase
Show the difference between merge and rebase:Example 3: Remote Repository Setup
Example 4: Share a Complex State
Useshare permalink in the application to generate a URL for any repository state:
Best Practices
URL Encoding Reference
Common characters that need encoding:| Character | Encoded | Usage |
|---|---|---|
| Space | %20 | Between command words |
| Semicolon | ; | Separates commands (no encoding needed) |
| Quote | %22 | For strings with spaces |
{ | %7B | JSON structures |
} | %7D | JSON structures |
[ | %5B | JSON arrays |
] | %5D | JSON arrays |
Semicolons (
;) do NOT need to be encoded when separating commands in the command parameter.Sharing on Social Media
When sharing on platforms like Twitter or LinkedIn:- Use a URL shortener (the full URLs are too long)
- Add context explaining what the link demonstrates
- Consider creating a demo GIF or screenshot to accompany the link
Embedding in Documentation
You can embed Learn Git Branching links in:- Markdown documentation (as regular links)
- README files
- GitHub wiki pages
- Blog posts
- Online course materials
Troubleshooting
URL Too Long
Problem: Repository state URLs generated byshare permalink are very long.
Solutions:
- Use a URL shortener service
- Simplify the repository state before sharing
- Use
export treeandimport treeinstead for very complex states - Create a custom level with Level Builder and use a gist URL
Commands Not Executing
Problem: The URL loads but commands don’t run. Check:- Ensure commands are properly URL-encoded
- Verify semicolons are separating commands correctly
- Check that the
commandparameter is spelled correctly - Test individual commands in the sandbox first
Special Characters Issues
Problem: Commands with quotes or special characters fail. Solution: Properly encode special characters:Alternative Sharing Methods
Export/Import Tree
For very complex states, use the export/import workflow:- In the application:
- Copy the JSON output
- Share the JSON with others (via gist, pastebin, etc.)
- They can import it:
Custom Levels
For reusable scenarios, create a custom level:- Use Level Builder to create the level
- Post the JSON to a GitHub Gist
- Share the gist URL:
?gist_level_id=YOUR_GIST_ID
- Scenarios you’ll share repeatedly
- Interactive challenges with specific goals
- Teaching materials
Next Steps
- Learn about Level Builder for creating sharable challenges
- Explore Git Golf for optimizing command sequences
- Practice in Sandbox Mode before creating permalinks
- See Levels for challenge ideas to share