smarber
smarber

Reputation: 5084

Is there a way to prefill TAG_EDITMSG file

I need to prefill the message of the tag that is about to be created created with some data. This way, once the editor is open, the user can check that data and do some changes if necessary.

The problem is that there is no hook that, AFAIK, can detect tag creation. And I can't just wrap tag command as we use which takes care of it among others.

I tried to work on TAG_EDITMSG file by creating it before running the command to finish a release/hotfix/...etc and to create the tag but that does not work because it is overwritten.

Is there a way to customize TAG_EDITMSG ?

Upvotes: 0

Views: 612

Answers (1)

Guildenstern
Guildenstern

Reputation: 3831

git tag --annotate test-msg --edit \
    --message=$'\n\n# Write your tag message\n# Are you making a new version or something...?'

This will give you this editor (| is the cursor):

|


# Write your tag message
# Are you making a new version or something...?
  • --message lets you provide the tag message. This would normally suppress the interactive editor since the message is given non-interactively
  • ... but --edit overrides that behavior and lets you edit the template that you have provided

Upvotes: 0

Related Questions