Three commands cover the entire core loop of using Git day to day. Everything in the lessons ahead builds on these.
mkdir my-project
cd my-project
git init
# Initialized empty Git repository in .../my-project/.git/This creates a hidden .git folder — that's the entire repository. Deleting it removes all Git history while leaving the actual project files untouched.
| State | Meaning |
|---|---|
| Untracked / Modified | A file Git sees but hasn't been told to track yet, or a tracked file that has changed |
| Staged | A change marked as ready to be included in the next commit |
| Committed | A change permanently saved into the project's history |
echo "# My Project" > README.md
git add README.md # stage one specific file
git add . # stage every changed file in the current folder and belowgit commit -m "Add README"
# [main (root-commit) a1b2c3d] Add README
# 1 file changed, 1 insertion(+)The -m flag provides the commit message inline — without it, Git opens the configured text editor to write one.
# 1. Make some changes to files
# 2. Check what changed (covered next lesson)
git status
# 3. Stage the changes
git add .
# 4. Commit them
git commit -m "Describe what changed and why"Writing a useful commit message
A good commit message describes why a change was made, not just what — "Add README" is fine for a first commit, but "Fix off-by-one error in pagination" is far more useful six months later than "Fix bug."