Git Academy

Intermediate · 4 min read

Tags and releases

Mark versions, push them, and never move a published tag.

Lightweight vs annotated

A lightweight tag is just a name on a commit. An annotated tag (-a) also stores the author, date and a message: use it for releases.

Safe
$ git tag -a v1.4.0 -m "Release 1.4.0"

Tags are not pushed by default

Push one tag, or let Git push the annotated tags of the commits you push.

Safe
$ git push origin v1.4.0
$ git push --follow-tags

Semantic versioning in 20 seconds

MAJOR.MINOR.PATCH: PATCH for fixes, MINOR for new compatible features, MAJOR for breaking changes. Conventional Commits (feat, fix, feat!) map directly onto it.

A tag never moves

Moving or deleting a published tag breaks everyone who installed that version. Made a mistake? Release v1.4.1.