What is a Git tag, and how do you use it for releases?
A Git tag marks specific points in a repository’s history — usually to label release versions
Follow:
(like v1.0, v2.1, etc.). It’s like a snapshot that says, “this commit is stable and ready to
release.”
Types of tags:
- Lightweight tag: just a name for a commit.
- Annotated tag: includes metadata like the tagger’s name, date, and message.
Commands:
git tag -a v1.0 -m "Version 1.0 release"
git push origin v1.0
Real-world example:
After testing your project, you tag the commit representing your first release with v1.0. This
helps other developers or CI/CD pipelines identify which version is live.