A diff tells the story of a change
Before committing, inspect which files changed and whether unrelated work entered the same set. A focused commit should represent one understandable outcome rather than every edit made during the day.
Branches isolate lines of work
A branch gives a feature or fix its own sequence of commits. It does not automatically protect uncommitted files, so always check the current worktree before switching, rebasing, or cleaning.
A familiar example
Adding a lesson page
- Inspect the current status and preserve unrelated files.
- Stage only lesson content, route, styles, tests, and its documentation.
- Commit after the focused tests and build pass so the checkpoint can be reviewed independently.
What to remember
- Read the diff before you commit.
- Keep commits focused on one coherent result.
- Never remove unfamiliar work just because it is uncommitted.