Git Tags
A tag marks a specific commit as important, typically to mark release points like v1.0 or v2.1.0. Unlike branches, tags don't move — they point permanently to one commit.
Git supports lightweight tags (just a name pointing to a commit) and annotated tags (which store extra metadata like the tagger's name, date, and message).
git tag v1.0
git tag -a v1.0 -m "message"
git push origin --tagsCreating tags
Use `git tag v1.0` for a lightweight tag, or `git tag -a v1.0 -m "Release version 1.0"` for an annotated tag with a message.
Listing and pushing tags
Run `git tag` to list all tags. Tags are not pushed automatically — use `git push origin tag-name` or `git push origin --tags` to push them to a remote.
git tag -a v1.0 -m "First stable release"Creates an annotated tag named v1.0 with a message, pointing to the current commit.
git tag
git push origin --tagsv1.0
...
To github.com:user/repo.git
* [new tag] v1.0 -> v1.0Lists all local tags and pushes them all to the remote repository.
Key points
- Tags mark specific commits, often for releases.
- Lightweight tags are just names; annotated tags store extra metadata.
- Tags don't move like branches do.
- Tags must be pushed explicitly with git push --tags.
