Skip to main content

Git Concepts Simulator

Practice Git in an interactive browser terminal with a visual repository model. Learn the working directory, staging area, local commits, branch pointers, remotes, fast-forward merges, fetch, and rebase.

Category: DevOps

Topics covered: git, version-control, terminal, branches, commits, merge, rebase, devops, educational, interactive

// simulator

Git Concepts Simulator

Practice Git in an interactive browser terminal with a visual repository model. Learn the working directory, staging area, local commits, branch pointers, remotes, fast-forward merges, fetch, and rebase.

Supported byBecome a sponsor
BitriseAtomsizedDigitalOceanDevDojoSMTPfastQuizAPI

// git mental model lab

Git Concepts Simulator

Practice Git by watching files move through the working directory, staging area, local repository, branch pointers, and remote repository.

Progress0/26

main

Branch

0

Staged

0

Working

Lessons
Lesson 1 / 6
Step 1 / 4

Start by checking where the lab repository lives.

git-concepts ~/repo
HEAD -> main

Welcome to Git Concepts Lab.

Type "help", run "git status", or follow the current task above.

$
Git Areas

Working Directory

Clean

Staging Area

Nothing staged

Local Repository

main -> b2c3d4e

working tree clean

Remote Repository

origin/main -> b2c3d4e

Commit Graph
b2c3d4e
HEAD -> main
origin/main

Add Alice

a1b2c3d

Add README

Pointer Model

HEAD follows main.

main points at b2c3d4e.

Branches and remote refs are labels. Commits are immutable snapshots with parent links.

About this Git simulator

What you'll learn

  • How the working directory, staging area, local repository, and remote relate
  • Why Git commits are snapshots with parent links
  • How branches and HEAD work as movable pointers
  • When a merge is a fast-forward instead of a merge commit
  • How fetch updates remote-tracking branches without touching your work
  • How rebase replays commits onto a new base

Key commands covered

  • Inspect: git status, git diff, git log, git branch
  • Snapshot: git add, git commit
  • Branch: git switch, git merge
  • Remote: git push, git fetch, git rebase

Concepts first

This lab is inspired by the “learn Git concepts, not commands” approach: commands make more sense once you can see what moved between the working tree, index, commits, branch labels, and remotes.

Browser-safe by design

This simulator does not run real Git. It models a small repository in the browser so you can experiment safely and build the mental model before using commands on real work.

Overview

Most Git confusion comes from not having a clear picture of where your changes are: in the working directory, in the staging area, in a local commit or on the remote. This simulator teaches that model first and the commands second. You start by looking around a small repository with git status and git log, then create a file, stage it, check the staged diff and commit it, and push it to the remote. Next you create a branch, commit on it and merge it back into main, watching how a branch is just a pointer that moves forward with each commit. The last lesson creates a feature branch, fetches what changed on the remote and rebases the branch onto origin/main, which shows the difference between fetching new commits and moving your own work on top of them. As you type, the simulator shows files moving through the working directory, the staging area, the local repository, the branch pointers and the remote, so you can see what changed instead of trusting the output text.

Try this

  1. In "Stage & Commit", add a file, run git diff --staged and commit it, watching the staging area empty.
  2. In "Branch Pointers", create a branch, commit on it and switch back to main to see which pointer moved.
  3. Finish "Fetch & Rebase" by fetching and rebasing a feature branch onto origin/main.

Frequently asked questions

What is the Git staging area?
Also called the index, it is where you assemble the exact changes that the next commit will contain. git add puts changes there and git commit records them.
What is the difference between git fetch and git pull?
git fetch downloads new commits from the remote without changing your branches. git pull fetches and then merges (or rebases, if configured) them into your current branch.
Should I merge or rebase?
Merging keeps the existing commits: a merge of diverged branches creates a merge commit, and a fast-forward just moves the branch pointer. Rebasing rewrites your commits on top of the target for a straight history. Avoid rebasing commits that others have already pulled.

Try next

Sponsored
Carbon Ads
$ cd /games
// share