What changed? git diff
Lesson 5 of 24 · Git.Micro
Before you commit, look at what you changed. git diff compares versions line by line, so you can commit related changes together.
git diff shows changes not staged yet: lines starting with - were removed, + were added.
git diff --staged shows what is already staged, that is, what the next commit will contain.
One commit, one idea: unrelated changes go in separate commits, so each is easy to read and to undo.
Check yourself
In the output of git diff, what does a line starting with + mean?
Two files changed. Commit only the price change with the message Update coffee price; leave the other change for later. Use git diff to see which file is which.
Do it in the browser: a real Git tool, a short mission and instant feedback. No install.
Start this lesson — free