Module 03 of 10 · init · add · commit · status

Your First Repository

The Core Workflow

Every time you use git, you follow the same three-step loop: edit files, stage them, then commit. Let's learn each step.

git init
edit files
git add
git commit

Step 1: git init

Navigate to your project folder and run:

git init

This creates a hidden .git folder that stores your entire history. Your files aren't touched — git just starts watching the folder.

Step 2: Create a File

In the simulator you can create files with touch or echo:

touch README.md
echo Hello World > README.md

Now run git status to see what git sees:

git status

You'll see README.md listed as an untracked file — git sees it but isn't tracking it yet.

Step 3: git add — Staging

The staging area is a preparation zone. You choose which changes to include in your next commit:

git add README.md

Or stage everything at once:

git add .

Run git status again — you'll see the file is now in Changes to be committed (shown in green).

Why stage? You might have edited 10 files but only want to commit changes to 3 of them. Staging lets you be precise about what each commit contains.

Step 4: git commit

Now save the snapshot permanently:

git commit -m "Add README file"

The -m flag lets you write the commit message inline. A good commit message explains why you made the change, not just what.

Good vs Bad Commit Messages

Check Your Work

After committing, run git status — you should see "nothing to commit, working tree clean." Your snapshot is saved.

The commit graph on the right updates live as you work. Watch a commit node appear after your first git commit.

Your Challenges

Run git init to create a repository
Create a file: touch README.md
Stage it: git add README.md
Commit it: git commit -m "..." (any message)
Make a second commit (add another file or edit README, then add & commit)
Module 3 complete! You know the core git workflow. These three commands — add, commit, status — are 80% of daily git use.
student@git-mastery: ~/my-project