"fix", "fix 2", "final fix" — and a database password on GitHub. That's what a day without a workflow looks like. In this module a mistake costs a minute, not a panic: every change is visible before it's saved, and anything can be undone.
Course
Git Basics Course · Module 2 of 7 · Stage 1 "On your own"
Learn
The add → commit cycle, reading history with diff and log, .gitignore, undoing changes
How
4 lessons on my-plugin with two uncommitted changes and a .env in the folder, all in the browser terminal
One day, one loop
flowchart LR
E["Edit code"] --> S["git status"]
S --> D["git diff<br/>what did I change?"]
D --> A["git add -p<br/>only what belongs"]
A --> C["git commit<br/>a message that explains why"]
C --> L["git log<br/>history you can read"]
L --> E
D -. "oops" .-> R["git restore<br/>git commit --amend"]
R -.-> E
classDef step fill:#fff7ed,stroke:#EE5133,color:#7c2d12
classDef undo fill:#ecfdf5,stroke:#10b981,color:#065f46
class E,S,D,A,C,L step
class R undo
Symptom → fix
Symptom
What you'll do instead
Commits named "fix", "fix 2", "final fix"
One logical change per commit, a message that says why
"What did I just change?"
git diff and git diff --staged before every commit
.env or a password pushed to GitHub
.gitignore from day one, and a plan if a secret already leaked
A broken file and no way back
git restore, unstage without losing work, --amend the last commit
You'll be able to answer
What makes a good commit message?
What's the difference between git diff and git diff --staged?