So, I know how to set a custom commit message template for git.
However, when I do an interactive rebase and use reword or squash, i would like to be able to set a custom message template for those commits as well.
So far, I haven't been able to find how to do this.
There's a few options, depending on what you're after — git throws quite a bunch of text buffers at you when you perform an interactive rebase.
Customizing the todo list generation (a.k.a
.git/rebase-$mode/todo-list
) can be done via a couple configuration keys :rebase.missingCommitsCheck controls git's reporting behavior when commit hashes are removed from the todo-list. Default is
ignore
, butwarn
anderror
are supported.rebase.abbreviateCommands controls whether git will prefer the "shorthand syntax" for rebase operations (eg.
p
,f
, instead ofpick
,fixup
, etc.).rebase.instructionFormat controls the todo-list generation itself.
If you want to customize the commit message itself while the rebase has been started, when you've asked for it (ie. on a
reword
,squash
, orfixup
operation), then you're likely after git commit --verbose, or its config variant, which you can set globally usingAs a "last resort", it's also possible to enable the .git/hooks/prepare-commit-msg hook and tweak its behavior, but IMHO it's more finicky .