Is there a standard naming convention for git tags?

I've seen a lot of projects using v1.2.3 as the naming convention for tags in git. I've also seen some use 1.2.3 . Is there an officially endorsed style, or are there any good arguments for using either?


Version 1.0.0 of Semantic Versioning, by Tom Preston-Werner of GitHub fame, had a sub-specification addressing this:

Tagging Specification (SemVerTag)

This sub-specification SHOULD be used if you use a version control system (Git, Mercurial, SVN, etc) to store your code. Using this system allows automated tools to inspect your package and determine SemVer compliance and released versions.

  • When tagging releases in a version control system, the tag for a version MUST be "vX.YZ" eg "v3.1.0" .
  • However, after discussion this was removed, and is no longer present in the latest version of the SemVer spec (2.0.0 at the time of writing). A later discussion thread in the same place went into greater depth, and resulted in a new Is "v1.2.3" a semantic version? being added to the FAQ in SemVer's master branch, although at the time of writing (over 2 years later) this change is still not present in the officially released spec.


    There appear to be two dominating conventions (assuming you also abide by some reasonable standard for numbering the releases themselves):

  • v1.2.3
  • 1.2.3
  • The advantages of v1.2.3 are that the Git documentation (and also the Mercurial documentation) uses that format in its examples, and that several "authorities" such as the Linux kernel and Git itself use it. (The mentioned Semantic Versioning used to use it but doesn't any more.)

    The advantages of 1.2.3 are that gitweb or GitHub can automatically offer a tarball or zip download of the form packagename-$tag.tar.gz (and I think it's quite established that a tarball should not be named package-v1.2.3.tar.gz ). Alternatively, you can use git describe directly to generate tarball version numbers. For lightweight projects without a formal release process, these possibilities can be quite convenient. It should also be noted that Semantic Versioning is by no means the only or a universally accepted standard for version numbering. And notable projects such as GNOME as well as countless other projects do use the 1.2.3 tag naming.

    I think it's probably too late to consolidate these positions. As always, be consistent and make sense.


    Update: As mentioned in this comment, GitHub now offers a tarball name with the 'v' stripped off of the tag.


    The reason for the preceding 'v' is historical. Older SCCS (cvs,rcs) could not distinguish between a tag identifier and a revision number. Tag identifiers were restricted to not begin with a numeric value so that revision numbers could be detected.

    链接地址: http://www.djcxy.com/p/41318.html

    上一篇: Ruby on Rails资源设计,单数还是复数

    下一篇: git标签有一个标准的命名约定吗?