2

Do you have any ideas how can I fire a script while I'm making tagging?

I know that currently there is no a separate git tag hook but it should be some way how to do that. For instance, try to use pre-push hook while you push your tags or something similar. Did anyone do such things?

Andrii
  • 43
  • 4

1 Answers1

2

Since there is no hook, you would need to make an alias, or your own git-tag script, in order to wrap the git tag command.

That way, you can tag and execute other commands.

As mentioned in your next question, you could use a pre-push hook to make that analysis, but by then, there could be a bit late (many commits could have been created, and many tags set before the user finally pushes)

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 1
    It is a good trick but how can I inject this solution to a group of developers in production? – Andrii Aug 02 '16 at 07:36
  • 1
    @AndreyRozumnyi By sharing that script `git-tag` on a shared PATH folder, folder they must declare in their PATH *before* the git.exe folder. – VonC Aug 02 '16 at 07:39
  • and can I reject the tagging if some conditions in the project don't hold? For instances, some of the references in git external file are untagged? – Andrii Aug 02 '16 at 10:21
  • @AndreyRozumnyi Yes, either in your script, or centrally in a pre-receive hook. – VonC Aug 02 '16 at 11:20
  • how can I do that in pre-receive hook, as in the provided example I need an access to the client project file. Git tag object by itself contains only metadata, so I don't see an option to do that centrally in this case or I missed something? – Andrii Aug 02 '16 at 12:20
  • @AndreyRozumnyi in that case, you need to check at the client-side script level indeed. – VonC Aug 02 '16 at 12:44
  • Possible to provide a sample alias which grabs current version and increments it? – jbord39 Jul 21 '17 at 18:13
  • @jbord39 on the client side, it really depends on the nature of your project. See for instance https://stackoverflow.com/q/6286937/6309 – VonC Jul 22 '17 at 04:45