Commits Worth Reading
One commit, one idea. A commit that fixes a bug, renames a variable, and adds a feature cannot be described in one sentence, cannot be reviewed, and cannot be undone without losing the other two things.
The test is simple: if your message needs the word and, it is probably two commits.
A message that works. Write a short line in the imperative, as if completing the sentence this commit will.
`
Add contact form validation
Fix navigation collapsing on mobile
Remove unused stylesheet
`
Not added stuff, not fixes, not asdf. You are writing to a future colleague, and that colleague is usually you.
✦ Staging is what makes atomic commits possible
You will often finish a session having done three unrelated things. Staging lets you commit them separately: add the files for one idea, commit, add the files for the next, commit again. The mess in your working directory does not have to become a mess in your history.
Mark this lesson complete
Signed in, your progress follows you to every device.