CodeOath
← All posts
Git65 min total · 17 parts

Git Internals and Workflows: Branching, Merging, and Rebasing

Contents — Part 14 of 17: Tags and Releases
Part 14 of 17 · ~1 min

Tags and Releases

A tag is a pointer to a specific commit, like a branch, but one that (by convention and by how tools treat it) isn't meant to move once created — used to mark a specific point in history as a release:

git tag v1.2.0                       # lightweight tag on the current commit
git tag -a v1.2.0 -m "Release 1.2.0"  # annotated tag: stores a message, tagger, and date
git push origin v1.2.0                # tags aren't pushed automatically — push them explicitly

An annotated tag is a full object in Git's database (with its own message, author, and date, independently of the commit it points to) and is generally preferred for anything meant to represent a real release; a lightweight tag is just a bare pointer, closer to a bookmark. Unlike a branch, a tag isn't expected to gain new commits — moving one after it's been shared is disruptive for exactly the same reason rebasing shared commits is.