Quickstart Guide
Get up and running with Learn Git Branching in just a few minutes. This guide will walk you through accessing the application, trying your first commands, and understanding the interface.Accessing the Application
Learn Git Branching is a 100% client-side JavaScript application with no backend required.Open the Application
Visit https://learngitbranching.js.org/ in your web browser.The application launches directly in sandbox mode with a basic git repository already created.
Understand the Interface
You’ll see two main areas:
- Command Line (bottom): Where you type git commands
- Visualization (center): Visual representation of your git repository showing commits, branches, and HEAD
- A root commit
C0 - One additional commit
C1 - A
mainbranch pointing toC1 HEADpointing tomain(indicated by an asterisk*)
Your First Git Commands
Let’s try some basic git commands to see how the visualization updates in real-time.Making a Commit
A commit in a git repository records a snapshot of all tracked files in your directory. In Learn Git Branching, you’ll see a new commit node (like
C2) appear in the tree, and the main branch will move forward to point to it.git commit, observe:
- A new commit node appears (e.g.,
C2) - The
mainbranch moves to point to the new commit - The new commit’s parent is the previous commit (
C1)
Creating a Branch
Branches in git are lightweight pointers to specific commits. Let’s create one:- A new branch label
bugFixappears - Both
mainandbugFixpoint to the same commit - The asterisk
*is still onmain(your current branch)
Switching Branches
To work on a different branch, usegit checkout:
- The asterisk
*moves tobugFix HEADnow points tobugFix- Future commits will move the
bugFixbranch forward
Combining Work with Merge
Let’s see how to combine work from different branches:Merging creates a special commit with two parents, combining the work from both branches. You’ll see a commit with two arrows pointing to its parent commits in the visualization.
Combining Work with Rebase
Rebase is an alternative to merge that creates a linear history:Rebasing takes a set of commits, “copies” them, and places them on top of another branch. This creates a cleaner, linear commit history.
Sandbox Mode Features
By default, Learn Git Branching launches in sandbox mode. Here are essential commands:undo
Undo the effects of your last command
reset
Start over with a clean slate
clear
Clear the command history from view
levels
Show available learning levels
Working with Remote Repositories
Simulate remote repository workflows with thegit clone command:
origin remote with remote tracking branches (prefixed with o/).
Clone creates a remote
After running
git clone, you’ll see remote branches like o/main in the visualization.Practice remote commands
Try commands like:
git fetch- Download commits from remotegit pull- Fetch and merge in one commandgit push- Upload your commits to remote
Starting Your First Level
Once you’re comfortable with the sandbox, try structured learning:Complete the goal
Each level has a specific goal shown in the interface. Match the goal tree structure to complete the level.
Essential Tips
Branches are just pointers
Branches are just pointers
Remember: branches in git are incredibly lightweight. They’re simply pointers to a specific commit. This is why the git philosophy encourages “branch early, and branch often.”
HEAD shows where you are
HEAD shows where you are
The
HEAD pointer (usually shown with an asterisk *) indicates which branch you’re currently on. Commits you make will move this branch forward.Don't fear experimentation
Don't fear experimentation
You can always use
undo to reverse a command or reset to start completely fresh. Experimentation is encouraged!Remote branches are read-only
Remote branches are read-only
Remote tracking branches (like
o/main) are local representations of the remote state. They only update when you run git fetch or git pull.Common Command Patterns
Here are some useful command patterns you’ll use frequently:Creating and Switching Branches
Basic Workflow
Remote Workflow
Next Steps
Start Learning Levels
Progress through structured tutorials from intro to advanced topics
Explore Sandbox Mode
Learn about all sandbox commands and features
Remote Operations
Master working with remote repositories
Open the App
Start practicing now!