Tags, Releases & SemVer
Marking Releases
Tags are permanent labels on a commit - used to mark versions you ship.
$ git tag -a v1.2.0 -m "Release 1.2.0" # annotated (recommended)
$ git push origin v1.2.0 # tags aren't pushed by default!
$ git tag # list
$ git checkout v1.2.0 # inspect that release
Semantic Versioning (SemVer)
Versions are MAJOR.MINOR.PATCH:
| Bump | When | Example |
|---|---|---|
| MAJOR | Breaking changes | 1.4.2 → 2.0.0 |
| MINOR | New features, backward-compatible | 1.4.2 → 1.5.0 |
| PATCH | Bug fixes only | 1.4.2 → 1.4.3 |
Tip: Annotated tags (-a) store author, date and a message and can be signed - always use them for releases. Lightweight tags (justgit tag v1) are fine for private bookmarks.
Warning:git pushdoes not push tags. Ship the release marker withgit push origin <tag>orgit push --tags, or your v1.2.0 exists only on your machine.