A helper for bumping versions via git tags.
Go
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
git
version
.gitignore
.goreleaser.yml
CONTRIBUTING.md
LICENSE
README.md
gitversion.go
gitversion_test.go
screwdriver.yaml

README.md

GitVersion

Build Status Open Issues

A helper for bumping versions via git tags.

Usage

gitversion --prefix v bump patch

Only semver-style versions with optional prefix are supported at this time (major.minor.patch).

gitversion will filter all tags of the format <prefix><major>.<minor>.<patch>-[prerelease], sort them, and increment the requested field (patch in this example) on the largest version. It then tags the current revision with the result.

e.g.

> git tag
v1.2.3
v1.2.4

> gitversion --prefix v bump patch
Bumping patch for version 1.2.4
1.2.5

> git tag
v1.2.3
v1.2.4
v1.2.5

> gitversion --prefix v show
v1.2.5

Auto

Auto is a special field that will determine the proper field to bump based on the contents of the last commit message. It looks for anything matching:

[major] or [major bump]

[minor] or [minor bump]

Example:

> git tag
1.2.3
1.2.4

> git log -1
[minor] Added show, major, minor, and auto features

> gitversion bump auto
1.3.0

And will default to patch if none found or if the commit is already tagged.

Prerelease

For prerelease versions, we automatically use the short git SHA (e.g. 1.2.3-1644da2).

note: prerelease tags should not be pushed to git, only used for local resolution.

Testing

go test ./...

License

Code licensed under the BSD 3-Clause license. See LICENSE file for terms.