Last week I made two commits that broke really obvious things. I was rushing and thought to myself “This is a simple change. Let’s just check it in.” I should have realized that these are every developer’s famous last words…
After these two incidents happened so close to each other, I knew I needed a way to remind myself to be more careful. To sanity check my changes for things the Continuous Integration build might miss.
Checklist for Pushing Code
- Rebase, build, and run tests (it’s quicker to run these locally rather than wait for CI build to fail)
- Sanity test changes
- Check that the app still starts
- Do a basic manual end-to-end sanity test to show your changes work
- Check the functionality around your change still works.
- Review the list of files in each commit (
git log --stat)
- Are all necessary files included?
- Are any files included that shouldn’t be?
- Read through the diff(s)
- Are there any unfinished sections?
- Are there any sections that you meant to refactor?
- Is each change in a commit related? (e.g. separate incidental code cleanups from feature/bug changes for clarity.)
- Do you want to reword the change description? (Remember it should have an imperative header, and a body describing what and why)
- Update relevant documentation
Some notable features:
- First it prints the
git logof the commits to be pushed.
- The most meaningful word in each check is highlighted to make the list quicker to read.
- It only asks once whether to continue with the push, rather than after each check.
Enterwill default to yes.
That’s it! Let me know if you have a similar checklist process. Especially if it has something you think it has something I should add to mine!