Read a Git Diff Before Committing
A working tree may contain debug output, accidental generated files or unrelated edits. This guide gives you a small, testable way to approach the issue before changing a live system.
A practical workflow
- Run git status and inspect the staged diff, not only the editor's file list.
- Stage only the intended hunks and run the focused test after the final change.
What to check
Never rely on a commit message to explain away a secret or customer file accidentally included. Compare the result with the original problem and record what changed. If a measurement or test does not support the change, revisit the assumption rather than adding more complexity.
Keep the experiment small enough to reverse. Document the starting state, the change and the result so another person can repeat the process. Product menus and versions can change, so check the current documentation for your environment.
Official reference: Read the documentation.