What Git actually is
Git is a version control system โ it takes snapshots ("commits") of your project over time, so you have a full history of every change, who made it, and why. It runs entirely on your computer; GitHub (next lesson) is a separate service for storing that history online.
Turning on Git for a project
git init turns the current folder into a Git repository โ it starts tracking changes from this point forward. You only run this once per project.
The three-stage mental model
git addgit commitThis two-step "stage, then commit" process feels like extra work at first โ its actual purpose is letting you choose exactly which changes go into each snapshot, instead of saving everything blindly.
The core daily workflow
git status constantly โ before and after almost everything. It never changes anything, it just tells you exactly what Git currently sees, which builds the habit of always knowing your project's state.
Writing good commit messages
| Weak | Better |
|---|---|
fix stuff | Fix broken image links in footer |
update | Add responsive styles for mobile nav |
A good rule: someone reading only your commit messages, six months from now, should understand what changed and roughly why โ without opening a single file.
Looking at your history
Undoing mistakes: the safety net in action
git restore means a bad experiment or a broken change is never permanent. You can always get back to a known-good state.
Ignoring files on purpose
A .gitignore file tells Git which files to never track โ things like dependency folders, secret keys, or system files that don't belong in your project history.
Try it yourself
git init inside it, create a file, and run git add then git commit -m "..." with a clear message. Run git log --oneline to see your first commit in history.
Level up: practice the undo
git status to see it listed as changed. Then run git restore on it and confirm the file goes back to exactly how it was in your last commit.
1. What does git add do?
2. What does git log show?
3. What's the purpose of a .gitignore file?
git add stages, git commit saves permanently, and git restore is your undo button โ as long as you commit regularly, you're protected from losing work.