Areas we serve
Chapter 2

What Version Control Actually Stores

Repository, working tree, staging, commit, and why a folder copy is not history.

Learning objectives

  • Define a repository, a commit, and a working tree in plain language
  • Tell a snapshot apart from a backup of “the folder”
  • See why agents need commits even when the app already runs

A folder is not a history

Right now the booking app is a directory of files. Save, and the old bytes are gone. Copy the folder to a USB stick, and you have one frozen pile with no labels. Version control replaces that pile with a repository: the files, plus an ordered list of commits that explain how the files got here.

A commit is one snapshot with four things attached:

  • the exact contents of the tracked files at that moment
  • a message written by a person or an agent, such as “add a waitlist when a class is full”
  • an author name and email, and a timestamp
  • a pointer to the parent commit, so the history is a chain, not a heap of zip files

The working tree is the folder you and the agent are editing right now. It can be dirty. A commit is the moment someone says “this version is worth keeping.” Until that happens, the agent’s edits are just unsaved intent.

What Git actually compares

Git does not store a full copy of every file on every commit if the file did not change. It stores content, then records which content belongs to which commit. You do not need the internals to supervise an agent. You do need the consequence: git diff can show the exact lines that differ between the working tree and the last commit, or between two commits. That diff is how you check an agent. Reading the chat is how you check the prompt. Reading the diff is how you check the product.

# From the studio folder, after git init and a first commit
git status          # which files are new or modified
git diff            # the line-by-line edit that is not committed yet
git log --oneline   # the chain of snapshots, newest first
WordWhat it is for Workshop Co.
RepositoryThe booking app plus its history. Usually a .git directory inside studio/.
Working treeThe files the agent is allowed to open and rewrite.
StagingThe short list of changes included in the next commit. git add puts a file on that list. Leaving a file unstaged is how you keep a secret out of the snapshot.
CommitOne approved snapshot. After this, git checkout or git revert can return to it.
BranchA name for “the tip of this line of work.” main should be the version you would show a customer.
Chat is not a commit

If the agent says “done, I fixed seats,” and you do not have a commit, you have a claim. Close the laptop lid, switch models, or start a new chat, and that claim can vanish while the broken files remain.

Name the object

The owner duplicates studio to studio-backup-tuesday. An agent then edits studio. Which of these is a commit: the backup folder, the agent’s chat reply, or neither?

Answer

Neither. The backup is an unlabeled copy of one moment, with no parent, no message, and no diff against later work. The chat is text. A commit exists only after Git records the snapshot in the repository.