Git tracks state through three "trees" — really three snapshots of file content:
- HEAD — the last commit on your current branch. Read it with
git show HEAD.
- Index (also called the staging area or cache) — what will be in the next commit. Read it with
git ls-files --stage.
- Working directory — the actual files on disk you can edit.
Every Git operation moves data between these three.
| Command | Working dir | Index | HEAD |
|---|
git add | → | ✓ | |
git commit | | → | ✓ |
git reset --soft | | | ← |
git reset --mixed (default) | | ← | ← |
git reset --hard | ← | ← | ← |
git checkout | ← | ← | |
Understanding which tree a command touches eliminates 90% of Git confusion.