Skip to content
Aback Games

Git Tangle

Learn git branching by doing it: type real git commands until your commit graph matches the goal. 12 levels, from commit to rebase.

  • Developer game
  • Free
  • No sign-up
  • Keyboard
  • Touch
Level1/12
Done0/12
Commands0
Best–

Make history

Make two commits on main.

git commit records a snapshot. Its parent is the commit HEAD is on, and the branch you are on moves forward to it.

Your repository
C0HEADmain
Goal
C0C1C2HEADmain

Loading the terminal…

Make your repository look like the goal.

Commits are circles; a dashed circle is a copy made by rebase or cherry-pick. Branch names sit under the commit they point to, and the filled one is the branch you are on. Only commits that change something count, and undo takes one back.

Enjoying Git Tangle? Share it:Post on X (opens in a new tab)

About Git Tangle

Git is easy to use and hard to picture. Most people learn a handful of commands by heart and hope nothing goes wrong. Git Tangle shows you what each command does to the commit graph, so branches, merges and rebases stop being a mystery.

Each of the 12 levels shows your repository next to a goal. Type git commands in the terminal and watch your graph change. When the two match, the level is solved. The commands are the real ones, with the same names and options you use at work.

How to play Git Tangle

Git Tangle controls

Keyboard
Run a commandType it and press Enter
Earlier commandsUp and Down arrows in the terminal
Next level, once solvedEnter on an empty line
Undo the last commandType undo, or press Undo
Sound on or offM (outside the terminal)
Touch screens
Start a commandTap a command chip, then finish typing
Run itTap Run
Undo, reset or next levelTap the buttons under the terminal

Git Tangle rules

The commands

git commit, branch (with -d, -D and -f), checkout (with -b), switch (with -c and --detach), merge (with --no-ff and --ff-only), rebase, cherry-pick, reset (with --hard, --soft or --mixed), log and status. Refs work as in git: a branch name, a commit such as C2, or HEAD, followed by ~n to go back n commits or ^n for a merge’s nth parent.

There are no files, so nothing ever conflicts and --hard makes no difference. Interactive rebase, revert, stash and remotes are not part of these puzzles.

Reading the graph

Each circle is a commit and each line joins a commit to its parent, older on the left. Branch names sit under the commit they point to; the filled name is the branch you are on, and HEAD marks the commit you are on. A dashed circle is a copy made by rebase or cherry-pick, labelled with a prime: C2′ is a copy of C2.

Commits that no branch can reach any more are not drawn, as if git had cleaned them up. You can still name them, as in git.

When a level is solved

Your repository must have the same branches as the goal, each pointing at a commit in the same place. The level’s own commits must match exactly; commits you make with git commit, and copies, only need to be in the right places, so any sequence of commands that builds the same history counts. Which branch you finish on does not matter.

The fewest commands you used for each level is saved in this browser. If you show the solution first, that level is not recorded on this visit.

Tips and strategy

  • Before typing, find what differs between the two graphs: a missing commit, a branch in the wrong place or a line that should be straight.
  • Check where HEAD is. Most commands work on the branch you are on, so git checkout or git switch first.
  • Merge keeps history as it happened, with a merge commit where branches join. Rebase rewrites it into a straight line by copying commits.
  • If the branch you are on has nothing of its own, git merge just moves it forward: a fast-forward, with no new commit.
  • Use git log to see the commits behind HEAD, and undo freely: it costs nothing.

Frequently asked questions

Is this real git?
It is a model of git’s commit graph that follows git’s rules for these commands. It runs entirely in your browser, with no repository or files, so you can experiment without breaking anything.
What is the difference between git merge and git rebase?
Merge joins two branches with a merge commit and keeps every commit where it was. Rebase copies your branch’s commits onto the tip of another branch, giving a straight history but new commits. Levels 4 and 9 let you try each.
What does detached HEAD mean?
HEAD normally points at a branch, and the branch moves when you commit. After checking out a commit directly, HEAD points at the commit itself, so new commits belong to no branch until you make one. Level 8 walks through it.
Do I need to install anything?
No. Git Tangle runs in your browser on desktop and mobile, with nothing to install and no account.

Guides and tips

Bug Hunt

Spot the buggy line in short JavaScript, Python and SQL snippets. 8 a round, with the cause and the fix after each.

  • Keyboard
  • Touch

Regex Runner

Write a regular expression that matches every string on one list and none on the other. 24 puzzles, from anchors to lookarounds.

  • Keyboard
  • Touch

Code Typer

A typing test for programmers: type real JavaScript, Python, Rust and SQL code against the clock.

  • Keyboard
  • Touch

All games