0

We have a script that takes the last tag from our git repository and parses it in order to create the version number.

In order to do so, the tag must have a defined pattern (vX.Y.Z).

Is it possible to avoid to create a tag that does not match a specific pattern, in order to avoid distraction errors?

David Neiss
  • 8,161
  • 2
  • 20
  • 21
Jepessen
  • 11,744
  • 14
  • 82
  • 149
  • On which platform do you run you git instance ? Github, Gitlab, personnal server? – Thomas Ayoub Jul 06 '16 at 13:32
  • It's our work server, running Ubuntu, but I'd like to check name on my local PC, using windows even if I can run linux commands in git bash. – Jepessen Jul 06 '16 at 13:35

2 Answers2

1

Maybe you can create a git alias of tag command to override/replace original tag command. In alias, you check the tag name.

See here for more details about git alias.

See here for how to pass argument to git alias.

UPDATE:

After some investigation, as this stackoverflow question, you can not override git command, but in that post, provide some methods to bypass this restriction.

Community
  • 1
  • 1
gzh
  • 3,507
  • 2
  • 19
  • 23
0

I'd say that you can't do it easily. Here are the places that I've looked:

  1. 2.6 Git Basics - Tagging
  2. git-tag man page
  3. git-verify-tag man page
  4. git-config

There is not a single mention on how/what to do to force tag format. I know that Gitlab provides git hooks to force commit message format.


You can take a look at How do I react to new tags in git hooks? and Is there a way to check that a git tag matches the content of the corresponding commit?

Community
  • 1
  • 1
Thomas Ayoub
  • 29,063
  • 15
  • 95
  • 142