explaingit

gazler/githug

6,944ShellAudience · developerComplexity · 1/5Setup · moderate

TLDR

A command-line game that teaches Git by making you solve real Git tasks in your terminal, level by level, the game checks whether your actual Git commands produced the correct result.

Mindmap

mindmap
  root((Githug))
    What It Does
      Git learning game
      Terminal challenges
    How To Play
      play command
      hint command
      reset command
    Skill Levels
      Basic staging commits
      Advanced operations
    Tech
      Ruby gem
      Docker option
    Compatibility
      Ruby 2.7.1 required
      Ruby 3.0 not supported
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Learn Git commands hands-on by completing progressively harder challenges instead of reading documentation.

USE CASE 2

Practice advanced Git operations like rebasing, cherry-picking, or resolving conflicts in a safe sandbox.

USE CASE 3

Use the Docker image to run Githug without installing Ruby on your local machine.

USE CASE 4

Contribute new Git challenge levels to help other beginners learn specific operations.

Tech stack

RubyShell

Getting it running

Difficulty · moderate Time to first run · 30min

Requires Ruby 2.7.1 specifically, does not work on Ruby 3.0 or higher, use the Docker image if you are on a newer Ruby version.

No license information is described in the explanation.

In plain English

Githug is a command-line game for learning Git. It presents a series of levels, each one asking you to accomplish a specific Git task in a real terminal session. When you think you have solved the current level, you run the play command and Githug checks whether your Git commands produced the correct result. If you are stuck, a hint command is available for most levels. The game installs as a Ruby gem with a single command. Once installed, you run githug in the folder where you want to store game files, confirm the setup prompt, and the first level begins. The four commands you use while playing are play (check your solution), hint (get a tip), reset (restart the current level), and levels (list all available levels). Each level sets up a fresh Git repository state for you to work with. Levels range from basic tasks like staging a file and making a commit to more advanced operations. The game is designed to give hands-on practice rather than just reading documentation, so you use actual Git commands at each step. A note on compatibility: the FAQ warns that Githug does not currently work on Ruby 3.0 or higher. The recommended version is Ruby 2.7.1. The FAQ also notes a common issue where answers are not recognized correctly, and provides a fix involving setting the default branch name to master before resetting the level. The project is open source and contributions are welcome, including new levels. A Docker image is also available as an unofficial alternative to installing Ruby locally.

Copy-paste prompts

Prompt 1
I'm stuck on a Githug level that asks me to squash commits. Give me a hint about which Git command to use without fully spoiling the answer.
Prompt 2
I want to add a new Githug level that teaches interactive rebasing. Walk me through the level file format and the validation logic I need to write.
Prompt 3
Githug isn't recognizing my answer on a level even though my Git output looks correct. What does the FAQ say about resetting the default branch name, and how do I apply that fix?
Prompt 4
I need to install Githug but I'm on Ruby 3.1. Show me how to use the Docker image as an alternative.
Prompt 5
List the Githug levels that cover remote repository operations like fetch, pull, push, and tracking branches.
Open on GitHub → Explain another repo

← gazler on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.