Git tags are essential markers in version control that help developers track and reference specific points in a project's history. They provide a way to label significant commits, such as software releases or important milestones.
Git tags are references to specific commits in a repository, typically used to mark release points or important stages of development. Unlike branches, tags do not change and remain fixed at a particular commit.
gitGraph
commit
commit
commit
tag: v1.0.0
commit
commit
tag: v1.1.0
Git supports two primary tag types:
Tag Type |
Description |
Use Case |
Lightweight Tags |
Simple pointers to specific commits |
Quick, temporary marking |
Annotated Tags |
Comprehensive tags with metadata |
Official releases, detailed information |
To create a lightweight tag:
git tag v1.0.0
To create an annotated tag with additional information:
git tag -a v1.1.0 -m "Release version 1.1.0"
The -a
flag creates an annotated tag, and -m
allows adding a descriptive message about the tag's purpose.
Tag Naming Conventions
Developers typically use semantic versioning for tags, such as:
v1.0.0
release-2023.06.15
stable-1.2.3
These conventions help maintain clarity and consistency in version tracking.