0

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 ?

smarber
  • 4,829
  • 7
  • 37
  • 78
  • 1
    Hacky but workable: replace the editor (see `git var GIT_EDITOR` which uses `$GIT_EDITOR`) with a program that writes the default message in, then runs the user's editor. – torek Feb 21 '18 at 18:55
  • @torek sorry but I didn't really get it. `git var GIT_EDITOR = editor` and `git config --get core.edit = vim`. How do I run the user's editor? – smarber Feb 21 '18 at 22:03
  • You'll need to (somehow) figure out what editor to run, then *change* `$GIT_EDITOR` to something else when running whatever git flow command you're using. Have the "something else" program detect, somehow, that you're tagging, and in that case, insert the default tag; then have the "something else" program run the user's editor. There are a lot of design choices in this whole setup, and none of them are particularly good, which is why this is such a hack. – torek Feb 21 '18 at 22:49

0 Answers0