Next: Commit Message Conventions, Previous: Commit Pseudo Headers, Up: Editing Commit Messages [Contents][Index]
git-commit-mode
is a minor mode that is only used to establish certain
key bindings. This makes it possible to use an arbitrary major mode
in buffers used to edit commit messages. It is even possible to use
different major modes in different repositories, which is useful when
different projects impose different commit message conventions.
The value of this option is the major mode used to edit Git commit messages.
Because git-commit-mode
is a minor mode, we don’t use its mode hook
to setup the buffer, except for the key bindings. All other setup
happens in the function git-commit-setup
, which among other things runs
the hook git-commit-setup-hook
.
Hook run at the end of git-commit-setup
.
The following functions are suitable for this hook:
Save the current buffer content to the commit message ring.
After this function is called, ChangeLog entries are treated as paragraphs.
Turn on auto-fill-mode
and set fill-column
to the value of
git-commit-fill-column
.
Turn on Flyspell mode. Also prevent comments from being checked and finally check current non-comment text.
Propertize the diff shown inside the commit message buffer. Git
inserts such diffs into the commit message template when the
--verbose
argument is used. magit-commit
by default does not offer
that argument because the diff that is shown in a separate buffer is
more useful. But some users disagree, which is why this function
exists.
Hyperlink bug references in the buffer.
Show usage information in the echo area.
Hook run after the user finished writing a commit message.
This hook is only run after pressing C-c C-c
in a buffer used to
edit a commit message. If a commit is created without the user
typing a message into a buffer, then this hook is not run.
This hook is not run until the new commit has been created. If
doing so takes Git longer than one second, then this hook isn’t run
at all. For certain commands such as magit-rebase-continue
this
hook is never run because doing so would lead to a race condition.
This hook is only run if magit
is available.
Also see magit-post-commit-hook
.
Next: Commit Message Conventions, Previous: Commit Pseudo Headers, Up: Editing Commit Messages [Contents][Index]