Git tags are essential markers in version control that help developers track and manage specific points in a project's history. Unlike branches, tags provide a permanent reference to a specific commit, making them crucial for software versioning and release management.
Git tags are snapshots of code at a specific moment, typically used to mark release points or significant milestones in a software project. They create immutable references to specific commits, allowing developers to easily identify and retrieve exact versions of their codebase.
gitGraph
commit
commit
commit
tag: v1.0.0
commit
commit
tag: v1.1.0
Tag Type |
Description |
Use Case |
Lightweight Tags |
Simple pointers to specific commits |
Quick, temporary markers |
Annotated Tags |
Contain additional metadata |
Official releases, comprehensive versioning |
To create a lightweight tag in Ubuntu, use the following command:
## Create a lightweight tag
git tag v1.0.0
## Create an annotated tag with message
git tag -a v1.1.0 -m "Release version 1.1.0"
Annotated tags include crucial metadata like the tagger's name, email, date, and an optional message, providing more context about the specific version or release.
Tag Naming Conventions
Effective tag naming follows semantic versioning principles:
- Major version (breaking changes)
- Minor version (new features)
- Patch version (bug fixes)
Example: v1.2.3
represents major version 1, minor version 2, and patch version 3.