history
git tag
Marks specific commits with a permanent name, typically for release versions like v1.2.0. Supports lightweight tags (a ref) or annotated tags (a full object with metadata).
git tag [<options>] [<tagname> [<commit>]] Common flags
| Flag | Purpose |
|---|---|
| -a <name> | Create an annotated tag with author, date, and message |
| -m <msg> | Message for annotated or signed tags |
| -s | Create a GPG-signed tag |
| -d <name> | Delete a local tag |
| -l <pattern> | List tags matching a glob pattern |
| -f | Force overwrite an existing tag |
Examples
git tag -a v1.0.0 -m "Release 1.0" Create an annotated release tag
git push origin v1.0.0 Publish a single tag to origin
git tag -l "v1.*" List all v1.x tags
Gotcha
Tags are NOT pushed by default; use 'git push --tags' or push each tag by name to make releases visible on the remote.
Related commands
git log
Displays commit history in reverse chronological order with filters for author, date, path, or content. The primary tool for exploring project history.
git push
Uploads local commits from a branch to a remote repository, updating the remote-tracking references. Requires push permission on the remote.
git branch
Lists, creates, renames, or deletes branches — pointers to commits. Does not switch branches on its own; use switch or checkout for that.
git cherry-pick
Applies the changes from one or more specific commits onto the current branch as new commits. Useful for porting bug fixes across branches.