Dualo
Git & GitHub

The three trees: working, staging, repository

Git has three areas: the files you edit (working tree), the changes you've prepared (staging), and the committed history (repository). Every Git command moves data between these.

1 min read

Git has three zones you should picture as separate boxes: the working tree, the staging area, and the repository.

  1. Working tree = the actual files in your folder. What you edit in your editor.
  1. Staging area (also called 'index') = a waiting room. You add changes here when they're ready to be saved, but you haven't committed yet. Lets you craft commits piece by piece.
  1. Repository = the permanent history. Once you commit, the snapshot is stored here forever (or until you explicitly rewrite history).

Flow: edit → git add (stages changes) → git commit (writes them to the repo). At any moment you can ask Git: 'what's in each zone?' with git status.

Why staging exists: you can edit 5 files but only commit 2 — by adding only those 2 to staging. This lets you split work into clean, focused commits instead of one giant blob.

Practice

The Git workflow:

Edit a file → to stage it → to write it to history.

Grounded on https://git-scm.com/book/en/v2/Git-Tools-Reset-Demystified

Next up

Your first commit

A commit is a snapshot with a message. You stage what you want, then commit with a description of *why* you made the change. That message is the gift you give to your future self.