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.
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).
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
- ❌
stuff - ❌
changes - ✓
Add README with project description - ✓
Fix login bug when password contains spaces
Check Your Work
After committing, run git status — you should see "nothing to commit, working tree clean." Your snapshot is saved.
git commit.
Your Challenges
git init to create a repository
touch README.md
git add README.md
git commit -m "..." (any message)