Write a template for commit messages.
amtoine opened this issue · comments
Once an issue has been opened, its topic discussed and the development of the feature or the bug fix accepted, a branch should be created.
Motivations for the template:
A great proportion of what will be seen from the outside of the branch will be the commit list. These have to be nice to read, concise and complete enough to give insights on the choices made by the developer.
A great way to encourage the authors of git commit
s to write "good" commit is to use a git commit
template.
Disclaimer:
The definition of what a "good" git commit
is is probably ill defined and is out of the scope of that issue. The idea of such a template, that could be adapted from project to project, is to allow the developers of the same project to write consistent git commit
s throughout the git
worktree, not to impose a single, narrow view of what a commit should be.
A first idea:
I found a pretty nice template here, but it has to be adapted of course!
Since the beginning of my internship this year, I have been using the following template, which has the benefit of being super small for what it's doing.
# ----------------------------------------------------------
# Header - (type): Brief description
# ----------------------------------------------------------
# * feat A new feature
# * fix A bug fix
# * docs Changes to documentation only
# * style Style/format changes (whitespace, etc.)
# * refactor Changes not related to a bug or feature
# * perf Changes that affects performance
# * test Changes that add/modify/correct tests
# * build Changes to build system (configs, etc.)
# * ci Changes to CI pipeline/workflow
# ----------------------------------------------------------
# ----------------------------------------------------------
# Body - More detailed description, if necessary
# ----------------------------------------------------------
# * Motivation behind changes, more detail into how
# functionality might be affected, etc.
# ----------------------------------------------------------
# ----------------------------------------------------------
# Footer - Associated issues, PRs, etc.
# ----------------------------------------------------------
# * Ex: Resolves Issue #207, see PR #15, etc.
# ----------------------------------------------------------
Notes:
A tutorial on how to install the template locally will be needed, e.g. in the README
.
Note that git commit
templates can be defined locally, for a single repo. There is no need to force a given template on other projects.