README
¶
version-tool - manipulate semantic version strings
A simple tool for manipulating semantic version strings.
Usage
version-tool is a simple utility for generating semantic version strings. It's meant to be used in your release pipeline to manipulate version strings, like bumping a patch version or attaching build information. This tool is expected to work with valid, well-formed version strings which adhere to the Semantic Versioning 2.0.0 standard.
MAJOR[.MINOR[.PATCH[-PRERELEASE][+BUILD]]]
Although deviating from the standard, version-tool respects the v prefix in
version strings. If the input version has the prefix, the output will as well.
2.4.2 -> 2.4.3
v2.4.2 -> v2.4.3
version-tool manipulates the version string provided as an argument. If no version string is provided, the latest semver (git) tag is used. Without any options, version-tool will bump the input version up a patch version.
2.4.2 -> 2.4.3
You can bump a major or minor version with the --major and --minor flags.
2.4.2 -> 2.5.0
2.4.2 -> 3.0.0
When bumping a version, existing pre-release identifiers are preserved.
2.4.2-alpha -> 2.4.3-alpha
You can change the pre-release identifier with the --pre-release flag.
2.4.2-alpha -> 2.4.3-beta
When bumping a version, existing build metadata is stripped.
2.4.2+001 -> 2.4.3
You can attach new build metadata with the --build flag.
2.4.2 -> 2.4.3+001
2.4.2+old -> 2.4.3+001
If your project adheres to the Conventional Commits standard, the release type (patch, minor, major) may be calculated from examining commit messages between HEAD and another git tag. The git tag provided as an argument must exist. If no tag argument is given, the most recent semver tag is used.
Command Usage
Usage:
version-tool [-M | -m | -p] [--pre-release <name>] [--build <meta>] [<string>]
Flags:
--build=<string>
Attach build metadata to the output version (e.g. 48f9aee, 20130313144700, 001).
-c, --conventional-commits
Calculate the version string by walking commits between HEAD and the tag argument and evaluating conventional commit messages.
--conventional-no-release-status=<int>
Exit with this status when no conventional release-worthy commits are found (e.g. all are 'chore' or similar non-release types).
-V, --drop-prefix
Skip the 'v' prefix on the output regardless of whether the input has it.
-h
show command usage information
--help
show command help information
-M, --major
Calculate the version string that is a major upgrade of the input.
-m, --minor
Calculate the version string that is a minor upgrade of the input.
-p, --patch (default true)
Calculate the version string that is a patch upgrade of the input.
-S, --pedantic (default true)
Strictly parse version strings according to the Semantic Versioning 2.0.0 specification. When pedantic parsing is disabled, version parsing is a bit more relaxed.
--pre-release=<string>
Attach a pre-release identifier to the output version (e.g. alpha).
Installation
To install, run
go install github.com/brandon1024/version-tool
or simply run without installation
go run github.com/brandon1024/version-tool --help
Examples
# bump version from the last project tag
version-tool
# bump a patch version
version-tool 2.3.4
2.3.5
# bump a minor version
version-tool -m 2.3.4
2.4.0
# bump a major version
version-tool -M 2.3.4
3.0.0
# bump version from conventional commit messages between HEAD and the last semver tag
version-tool -c
# bump a patch version and include pre-release identifier
version-tool --pre-release=alpha 2.3.4
2.3.5-alpha
# bump a patch version and include build metadata
version-tool --build=20130313144700 2.3.4
2.3.5+20130313144700
# bump a version with relaxed parsing
version-tool --pedantic=false v0.3
v0.3.1
# manipulate a version without incrementing it
version-tool --patch=false --pre-release alpha --build 001 2.3.4
2.3.4-alpha+001
# find the latest version
version-tool --patch=false
2.3.4-alpha+001
Building
make
License
MIT License. Copyright (c) 2026 Brandon Richardson.
Documentation
¶
There is no documentation for this package.