I’m coaching @dylangrafmyre on what happens when you’re ready to commit code, so here’s a quick checklist. Let me know if there’s anything to add.
- Get all the tests passing first (if possible).
- Open up a scratchpad to start jotting down the commit message.
- Go through each diff (in RubyMine):
- Remove any debug print statements.
- Ensure that the right level of commenting is used. No comments that are better done with code. Use comments for something like some test code that should work but doesn’t and that might get fixed by some gem upgrades.
- Remove any commented code.
- Clean up formatting for changed lines.
- Consider whether the set of changes should be one commit or multiple commits.
- Run the tests again if you’ve changed any files.
The goals for each commit should be to:
- Tell a small, self-contained story.
- Make it easy for your code reviewer.
- Be useful for running a
git bisectto track down any regressions.