Skip to main content

Overview

Learn Git Branching includes a comprehensive set of levels (tutorial challenges) designed to teach Git concepts through hands-on practice. Each level presents a specific goal that you must achieve using Git commands.

Viewing Available Levels

To see all available levels and your progress, use the levels command:
levels
This opens an interactive dialog showing:
  • All level sequences organized by topic
  • Which levels you’ve completed (marked with checkmarks)
  • Your Git Golf score for each level
  • Brief descriptions of each sequence

Level Sequences

Levels are organized into sequences that teach different aspects of Git. Each sequence focuses on a specific topic and builds progressively in difficulty.

Main Tab Sequences

Introduction Sequence

A nicely paced introduction to the majority of git commands Levels:
  • Introduction to Git Commits
  • Branching in Git
  • Merging in Git
  • Rebase Introduction
Start here if you’re new to Git! This sequence covers the fundamental concepts you’ll use every day.

Ramping Up

The next serving of 100% git awesomeness Levels:
  • Detach yo’ HEAD
  • Relative Refs (^)
  • Relative Refs #2 (~)
  • Reversing Changes in Git

Moving Work Around

“Git” comfortable with modifying the source tree Levels:
  • Cherry-pick Intro
  • Interactive Rebase Intro

A Mixed Bag

A mixed bag of Git techniques, tricks, and tips Levels:
  • Grabbing Just 1 Commit
  • Juggling Commits
  • Juggling Commits #2
  • Git Tags
  • Git Describe

Advanced Topics

For the truly brave! Levels:
  • Rebasing Multiple Branches
  • Multiple Parents
  • Branch Spaghetti

Remote Tab Sequences

Push & Pull — Git Remotes!

Time to share your 1’s and 0’s kids; coding just got social Levels:
  • Clone Intro
  • Remote Branches
  • Git Fetch
  • Git Pull
  • Faking Teamwork
  • Git Push
  • Diverged History
  • Locked Main
The Remote tab focuses on collaborative Git workflows using remote repositories. Make sure you understand local Git operations before diving into remotes.

To Origin And Beyond — Advanced Git Remotes!

And you thought being a benevolent dictator would be fun… Levels:
  • Push Main!
  • Merging with Remotes
  • Remote Tracking
  • Git push Arguments
  • Git push Arguments — Expanded!
  • Fetch Arguments
  • Source of Nothing
  • Pull Arguments

Starting a Level

To start a specific level, use the level command:
# Start a level by name (spaces and case don't matter)
level intro1
level "Introduction to Git Commits"

# Or select from the levels dialog
levels
# Then click on the level you want

Level Interface

When you’re in a level, you’ll see:
  1. Level Name - Displayed in the toolbar at the top
  2. Goal Visualization - Shows what the final repository should look like
  3. Main Visualization - Your current repository state
  4. Command Input - Where you enter Git commands

Level-Specific Commands

While solving a level, you have access to special commands:

Show Goal

View the goal state you need to achieve:
show goal
This opens a window showing the target repository structure. You can drag this window to position it conveniently.

Hide Goal

Close the goal visualization window:
hide goal

Show Solution

View the official solution for the level:
show solution
If you view the solution before completing a level, it won’t count as “solved” in your progress tracking.
You can also access the solution by adding --force to skip the confirmation:
show solution --force

Objective

View the level’s objective dialog (the instructions that appeared when you started):
objective
This is helpful if you need to review what the level is asking you to do.

Hint

Get a hint for the current level:
hint
Not all levels have hints, but many do to help you if you’re stuck.

Completing a Level

When you successfully achieve the goal state:
  1. An animation celebrates your success
  2. A results dialog shows:
    • How many commands you used
    • The optimal solution command count
    • Whether you achieved the Git Golf best score
  3. You’re asked if you want to proceed to the next level
You can replay levels to improve your Git Golf score! Try to match or beat the optimal solution.

Exiting a Level

Return to sandbox mode at any time:
exit level
# or simply
sandbox

Using URL Parameters

You can link directly to a specific level using URL parameters:
https://learngitbranching.js.org/?level=intro1
This is useful for:
  • Bookmarking specific levels
  • Sharing level links with others
  • Returning to a level you were working on
See Sharing Permalinks for more ways to share content.

Resetting a Level

If you want to start a level over:
reset
This returns the repository to the level’s starting state, allowing you to try again with a fresh approach.
Resetting a level does NOT undo your “solved” status. If you already completed the level, it will still show as solved.

Progress Tracking

Your progress is automatically saved in your browser’s local storage:
  • Completed levels are marked with checkmarks
  • Best scores are tracked for Git Golf
  • 📊 Overall progress is shown in the levels dialog

Resetting Progress

If you want to clear all your solved levels:
reset solved --confirm
This will mark all levels as unsolved and clear all your Git Golf scores. This action cannot be undone.

Tips for Success

Read the instructions carefully - Each level has specific requirements. Use the objective command to review them.
Visualize before executing - Look at the goal state and plan your commands before starting.
Use undo liberally - Don’t be afraid to experiment! Use undo to backtrack and try different approaches.
Check your work - Keep the goal visualization open (show goal) to compare as you work.
Learn from solutions - After completing a level, review the official solution to learn more efficient approaches.

Level Navigation

Levels are designed to be completed in sequence, but you can:
  • Skip ahead to any level using level <name>
  • Return to previous levels to replay them
  • Jump between different sequences
  • Work on levels from multiple sequences simultaneously

Next Steps

Build docs developers (and LLMs) love