The Core Workflow

Git revolves around a simple 3-step workflow: Modify → Stage → Commit.

✍️

1. Modify

Create or edit files

📦

2. Stage

Select changes to save

💾

3. Commit

Save snapshot permanently

1. Initialize (git init)

Turns a regular folder into a Git repository. This creates a hidden .git folder that tracks every change you make.

mkdir my-project
cd my-project
git init

2. Check Status (git status)

Your best friend. Tells you exactly what's going on: which files are modified, staged, or untracked.

git status

On branch main

Untracked files:

index.html

3. Stage Changes (git add)

Moves files from "Modified" to "Staged". Think of this as putting items into a box before sealing it.

# Stage a specific file
git add index.html

# Stage ALL changed files (Common)
git add .

4. Save Snapshot (git commit)

Seals the box. Saves a permanent snapshot of the staged files with a message describing what you did.

git commit -m "Create homepage layout"

Writing Good Commit Messages:

✅ Good

"Add login form validation"

❌ Bad

"Fixed stuff"

5. View History (git log)

See a list of all commits in the repository's history.

git log

# One-line summary (Cleaner)
git log --oneline

Interactive Practice

Try the workflow yourself! We've initialized a repo for you.

bash — 80x24

Loading terminal...

Mission 1:

Create a file called style.css and check status.

touch style.css && git status

Mission 2:

Stage and commit the file.

git add . && git commit -m "Add styles"