cools maths gamesSurprise me

Learn Git Branching

Solve 36 tree-shaping puzzles by typing git commands into a simulated terminal with a live commit graph.

Learn Git Branching title screen
  • Desktop recommended
Report a problem

Learn Git Branching is a puzzle game that teaches version control by drawing it. A terminal sits on the left, and a diagram of commits and branches fills the rest of the screen. Your goal in each level is to type git commands until your tree matches the target shape.

How Learn Git Branching Works

Each level opens with a short lesson, often with an animated demo of the new command. Close it, then type something like git commit, git branch feature or git checkout main and press Enter. The circles and branch labels move to show the result.

A goal window shows the tree you need. Compare it with yours, hide it and keep working. Typing undo steps back one command, and reset restarts the level. Solved levels are remembered in your browser.

You get 36 levels in total. Twenty sit under Main, grouped into five sets that start with basics and end with advanced material. Sixteen more live under Remote and cover cloning, fetching, pulling and pushing. Type sandbox any time to experiment with no goal.

Your First Few Minutes

  1. Read the opening lesson and click through its demo.
  2. Type git commit and press Enter, then watch a new circle appear.
  3. Type show goal to compare your tree with the target.
  4. Keep typing commands until the trees match.
  5. Type levels to open the menu and pick the next puzzle.

Controls for Learn Git Branching

Keyboard, mouse and touch controls for Learn Git Branching
To do thisKeyboardMouse
Type a commandType anywhere on the page, then Enternot used
Open the level menu and pick a levelType levels, then arrow keys and EnterClick a level number in the menu
Compare your tree with the targetType show goal (or hide goal)Click Show Goal on the level bar
Get a hint or read the lesson againType hint, or objectiveClick Instructions on the level bar
Take back the last commandType undo (or reset to start over)not used
Page through a lesson or close itRight arrow or Enter for next, Left arrow for back, Escape to closeClick the arrows or the check mark

What It Trains

This is a coding game in a real sense. You learn what commands like branch, merge, rebase and cherry-pick do by seeing the tree change after each one.

It also trains logic and spatial reading. Before typing, you look at the goal, count commits and work out the shortest set of moves that gets you there.

Strategy Notes

  • Find the asterisk. That mark shows where HEAD is, which is where your next commit goes.
  • Use relative refs. main^ and HEAD~2 beat reading commit IDs off the screen.
  • Read the goal shape. Copied commits point to rebase or cherry-pick, and a commit with two parents means a merge.
  • Undo is cheap. Step back a command rather than restarting the whole level.
  • Warm up in sandbox. A few free commands make later rebase levels clearer.

Good to Know

You need a physical keyboard, and the game itself warns that phones and tablets cannot take input. Progress is saved in your browser, and the language can be changed from the bottom corner. Peter Cottle created Learn Git Branching.

Learn Git Branching questions and answers

How do I know I solved a level?

When your commit tree matches the goal tree, the level is marked as solved and the game offers the next one. If you also match the reference solution's command count, the menu shows a gold star for that level.

Do I need to know git before I start?

No. The first set begins with a single commit and explains each command in a short lesson, often with a demo. Later sets build on earlier ones, so working through them in order helps.

Does anything happen to my real files?

No. The repository is simulated and drawn in the browser. The commands behave like git, but nothing touches your computer's files or any real project.

What if I get stuck?

Three typed helpers exist. Hint gives a small push, objective brings the lesson back, and show goal redisplays the target. There is also show solution, which plays the answer for you, though the level then stays unsolved.

Games that use coding like Learn Git Branching

Different rules, same kind of thinking.

Try something from another shelf