Atomic commits
<aside>
💡 Atomic commits make it easy to roll back without affecting other changes and to make other changes on the fly. It also becomes a lot easier to merge the code into master and deal with potential conflicts.
</aside>
Keep commits small and atomic:
- Commit each fix or task as a separate change
- Only commit when a block of work is complete
- Commit each layout change separately
- Each commit must pass build, linting and tests
Writing a useful commit message
Consider the guidelines in How to Write a Git Commit Message.
They list "the seven rules of a great Git commit message":
- Separate subject from body with a blank line
- Limit the subject line to 50 characters
- Capitalize the subject line
- Do not end the subject line with a period
- Use the imperative mood in the subject line
- Wrap the body at 72 characters
- Use the body to explain what and why vs. how
The most useful recommendations are:
Use the imperative mood in the subject line