A lot of projects (e.g. Linux) prepend v
to their git version tags, e.g. v3.19
which makes parsing of those tags harder for no obvious reason. What's the sense of doing that?
Tagging is generally used to capture a point in history that is used for a marked version release (i.e. v1. 0.1). A tag is like a branch that doesn't change. Unlike branches, tags, after being created, have no further history of commits.
Annotated Tags If you are pointing and saving a final version of any project, then it is recommended to create an annotated tag.
Using Git to Create a Version NumberThe git describe command returns the latest tag on the current branch. If additional commits have been made after the tag, the tag name is suffixed with the number of additional commits and the hash of the tip commit.
In the previous example, we created a lightweight tag. Lightweight tags and Annotated tags differ in the amount of accompanying metadata they store. A best practice is to consider Annotated Tags as public, and Lightweight Tags as private. Annotated tags store extra metadata such as the tagger name, email, and date.
As mentioned in "Is there a standard naming convention for git tags?":
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.
That convention is not enforced with Semantic Versionning in its 2.0 revision. It was in its 1.0 revision:
When tagging releases in a version control system, the tag for a version MUST be "
vX.Y.Z
" e.g. "v3.1.0
".
The fact it is no longer enforced shows how optional that 'v' can be.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With