Automatically create semantic version git tags.
$ tag
Push tag 'v1.0.1' to origin? (y/N): y
Tag 'v1.0.1' created and pushed to origin.
By default, tag will increment the smallest digit following SemVer precedence.
Incrementing a specific version is achieved by passing the respective flag: --major, --minor, --patch.
Tags can be automatically pushed to a remote repository by passing --push.
tag supports pre-release versions.
Creating a pre-release tag is achieved by the using the --suffix flag.
For example, --suffix="alpha" will create a tag like v1.0.0-alpha.
If the previous tag was for a pre-release, that suffix is preferred.
This behavior can be overridden by passing --patch or --suffix="".
Only incrementing the trailing pre-release identifier is currently supported.
tag authoritatively discourages duplicate tags for a single commit.
For the most up-to-date options, run tag --help,
$ tag --help
Calculate the next semantic version tag
Usage:
tag [flags]
tag [command]
Available Commands:
completion Generate completion script
help Help about any command
Flags:
--check validate that the tag at HEAD has its previous version as an ancestor
--debug enable debug logging
-h, --help help for tag
--major increment the major version
--metadata string set the build metadata
--minor increment the minor version
--patch increment the patch version
--prefix string set a prefix for the tag
--print-only print the next tag and exit
--push create and push the tag to remote
--remote string remote repository to push tag to (default "origin")
--suffix string set the pre-release suffix (e.g., rc, alpha, beta)
-v, --version version for tag
Use "tag [command] --help" for more information about a command.
tag provides autocomplete for bash, fish, powershell and zsh shells.
For example, to enable autocomplete for the bash shell,
tag completion bash | sudo tee /etc/bash_completion.d/tag > /dev/nullNote: bash completion requires the bash-completion package be installed.
For more information, see tag completion <shell> --help for your respective <shell>.
AUR:
tag is available from the Arch User Repository.
yay -S release-tagpip:
tag is available as a pypi package.
pip install release-taggo:
go install github.com/jmelahman/tag@latestgithub:
Prebuilt packages are available from Github Releases.
In your .pre-commit-config.yaml,
default_install_hook_types:
- pre-push
repos:
- repo: https://github.com/jmelahman/tag
rev: a069af54b5de5379d3581e3fc027395d1ad0a982 # frozen: v0.5.0
hooks:
- id: tag-checkBy default, it only runs on the pre-push stage,
so you may need to install the pre-push hook after staging your changes.