Is there a way to setup a git tag
message template similar to the way the commit message template works?
With git config
we could configure a template for commits, pointing to some .git-msg-template
. This would, for example in ~/.gitconfig
, look like this:
[commit]
template = ~/.git-msg-template
However, if you read through the git documentation or simply lookup the git config tag.*
options in terminal, there seems to be no git config tag.template
, only git config commit.template
setting.
Nevertheless, even without setting up a custom commit.template
, the default message for commits and tags differs for me. Commits start with Please enter the commit message ...
, add branch information and so on while tags simply have Write a message for tag: v1.0.0
. Thus, internally, there should be different templates for commits and tags?!
There is no template file option for git tag
; the template is hard coded into the Git source. There is, however, a -F
argument that reads the message from a file. Note that git tag -m
or git tag -F
will skip running the editor unless you also add --edit
. You could therefore get the effect you want using:
git tag --edit -F ~/.git-tag-template
(I suspect a patch that adds a template-file configuration to git tag
, with the code similar to that in builtin/commit.c
, would be welcome.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With