RadarTrek
Home/Courses/Git & GitHub/The Three Stages + Your First Commit
Lesson 03 / 8·8 minFree

The Three Stages + Your First Commit

git init · git add · git commit — three commands that cover 80% of daily Git use

Git has one concept that confuses almost everyone at first: the staging area. Understand this and the rest becomes obvious.

The three stages

Working Directory Files you edit src/index.ts style.css Staging Area Ready to commit ✓ index.ts Repository Committed history ○ a1b2c3d git add git commit

Before a change is in your history, it goes through three stages. Understanding this is the key to using Git confidently.

Stage 1: Working Directory

This is your normal file system — the folder on your computer where you write code. Git watches it but does nothing automatically. Changes here are "untracked" or "modified."

Stage 2: Staging Area (Index)

The staging area is a holding zone. You pick which changes to include in the next commit by staging them. This lets you make one commit with just the login fix and another with the new feature, even if you worked on both at the same time.

!

Why staging exists

It gives you control over what goes in each commit. You can work on 5 things at once and commit them as separate, meaningful snapshots. Without it, every commit would include everything you changed since the last one.

Stage 3: Repository (Local History)

Once you commit, the staged changes become a permanent snapshot in your local history. This is stored in the hidden `.git` folder in your project.

Your first real commit

Open a terminal in your project folder and run these commands in order:

Terminal — run these in your project folder

# 1. Initialize Git in this folder (do this once per project)
git init

# 2. Check what Git sees
git status

# 3. Stage all files (the dot means "everything")
git add .

# 4. Take the snapshot with a message
git commit -m "Initial commit"

# 5. See your history
git log --oneline

Understanding git status

Run `git status` constantly. It tells you exactly what's happening:

Example git status output

On branch main

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        modified:   src/index.ts       ← staged, will be in next commit

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
        modified:   style.css          ← changed, not yet staged

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        notes.txt                      ← new file Git doesn't know about

Staging specific files

Instead of `git add .` (everything), you can stage specific files:

Staging options

# Stage everything changed
git add .

# Stage a specific file
git add src/index.ts

# Stage a folder
git add src/

# Stage interactively (choose line by line)
git add -p
!

The workflow you'll use 90% of the time

Make changes → git add . → git commit -m "describe what you did" → repeat. That's it. Everything else builds on this foundation.

RadarTrek Intel — monthly score updates

We track 40+ tools so you don't have to. Score changes, new tools, and new guides — once a month, no spam.