git tag -a <version_number>

Creates an annotated Git tag named `<version_number>` pointing at the current commit.

This command creates an annotated tag that records a version identifier and metadata for marking significant points in your project's history.

The -a flag instructs Git to build an annotated tag object, capturing author information, date, and a message; <version_number> names the tag; Git then opens your default editor so you can enter a descriptive tag message before attaching it to the current HEAD commit.

Closely related variations include using -m to supply the message inline (e.g. git tag -a <version_number> -m "Release notes"), or -s to create a PGP-signed annotated tag; you can create a lightweight tag without metadata by omitting -a (i.e. git tag <version_number>). Other complementary commands are git push origin --tags to send tags to a remote, git tag -d <version_number> to delete a tag, and git show <version_number> to display tag details.

Example:

git tag -a 2.0.1
Related commands

Welcome to GitExamples!

Sign in to enable bookmarking, reminders, progress-tracking and more...