Appearance
Writing Commit Messages
Commit messages are an essential part of version control in GitHub. They document the changes you make, explain the reasons behind those changes, and help others (including your future self) understand the history and evolution of a project. Clear and descriptive commit messages are especially important in collaborative environments, where multiple contributors rely on them to stay aligned.
Why good commit messages matter:
- They make it easier to understand what changed without reading the code.
- They help trace bugs or regressions by reviewing past commits.
- They improve teamwork by keeping everyone aligned on updates and progress.
General Guidelines
- Be clear and specific. Summarize what changes and why.
- Use the present tense and imperative mood. Write as if giving a command, e.g., “Add mesh refinement script” instead of “Added mesh refinement script.”
- Keep the first line short (under 50 characters). If more detail is needed, add a blank line and then a longer description.
- Group related changes into a single commit. Don’t mix unrelated updates.
- Reference related issues or features if applicable (e.g., “Fix issue #12”).
Example Commit Messages
Good Examples
Add function to export mesh with region markersUpdate README with installation instructionsFix boundary condition bug in electromagnetic solverRefactor preprocessing script for clarity and reusabilityPoor Examples
updatefinal changesfixed stuffThese provide no context and make it difficult to understand what was actually changed.
Recommended Format
python
<type>: <short summary>
<optional detailed description>
<optional reference>Example:
python
feat: Add support for custom boundary markers
Allow users to specify named boundary regions directly from Salome export.
Improve clarity when defining boundary conditions in FEniCS.Common types:
feat:– add a new featurefix:– fix a bugdocs:– update documentationrefactor:– restructure code without functional changestest:– add or modify tests
Summary
A good commit message should read like a directive — describing what the commit does right now. Writing messages in present tense (“Fix bug” instead of “Fixed bug”) keeps them consistent and action-oriented, aligning with professional Git practices.
Consistent, descriptive commits are a small effort that make a big difference in collaborative research and development.