Commit 9204575
Eric James Michael Ritz
Add a default Git commit template message
Git allows users to have "templates" for commits which, when they
exist, automatically fill the user's editor with the template contents
whenever they make a commit. This does not prevent the user from
further editing the commit message; all it does is pre-populate the
message with pre-written text.
In an effort to help improve the quality of commit messages on PHP
Mode, this patch introduces a commit template along with a Git hook
that, when applied, will automatically fill commit messages with
said template. The template has comments describing some basic
best-practices for writing Git messages, and has commented-out lines
of some metadata we use, i.e. lines like
GitHub-Issue: #9001
Reviewed-by: Vegeta
This patch updates the Makefile with a new rule, `dev`, that will
install the hook. However, developers have another way to use the
template, which will be necessary for anyone who happens to already
be using the `prepare-commit-msg` hook for something: users can open
`.git/config` in the project's top-level directory (tip: `git rev-parse
--show-toplevel`) and add the following:
[commit]
template = ./etc/git/commit-template.txt
This will apply the commit template for *every* commit. In contrast,
the hook will only use the template if it can determine the user does
not already have a template in place or that a different tool has
pre-populated the commit message with some text. So in that regard
the two approachs to using the template are different.
Signed-off-by: Eric James Michael Ritz <ejmr@no.current.address>1 parent cf1907b commit 9204575
3 files changed
+54
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
22 | 28 | | |
23 | 29 | | |
24 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
0 commit comments