Why Avoiding -m in Git Commits Improves Message Clarity
Oliver Davies urges developers to rethink their use of Git’s -m
flag when committing changes. The -m
option only allows for a brief subject line, often missing critical context. By avoiding -m
, Git opens the default editor, enabling developers to write more thoughtful, informative messages.
Oliver compares commit messages to emails: a subject line followed by a body. While the subject summarizes the change, the body provides space to explain why the change was needed, outline alternative approaches considered, and note any side effects or deployment steps.
The post emphasizes that detailed commit messages are not just for others—they’re future references for the developer themself. Oliver encourages using this space to write what one would find helpful when reviewing project history via git log
.
This reminder is simple but practical, aimed at improving long-term collaboration and project maintainability.