A lightweight Go tool to automatically determine the next semantic version of a Git repository and create a tag based on commit messages.
This tool:
-
Reads commits since the last tag
-
Determines the next version (major / minor / patch)
-
Creates a Git tag
-
Optionally pushes the tag to the remote
It is inspired by tools like semantic-release, but intentionally simpler and more flexible for real-world teams.
Version bump is determined from commit messages using a flexible interpretation of Conventional Commits.
The tool supports multiple commit styles:
feat: add login
fix(api): resolve error
feat!: breaking change
[FEAT] - add new feature
[FIX] - bug fix
[BREAKING] - change API
Commit Type
Version Bump
feat, [FEAT]
Minor
fix, [FIX]
Patch
BREAKING, !
Major
others
Ignored
If the repository has no tags, the tool will:
-
Analyze all commits
-
Start from
v0.0.0 -
Apply normal bump rules
Example:
[FEAT] initial commit → v0.1.0
go build -ldflags "-X main.version=v0.2.0" -o git-semver
Or run directly:
go run .
git-semver
git-semver --repo ../other-project
git-semver --repo ../other-project --push
Flag
Description
Default
--repo
Path to Git repository
.
--push
Push tags to remote
false
--json
json format output
{ "current_version": "v0.2.1", "next_version": "", "release_type": "none", "has_release": false, "pushed": false }
--version
git-semver Version
-
Git installed and available in PATH
-
Repository must:
-
be cloned locally
-
contain commit history
-
have correct remote configured (for push)
-
This tool requires full history and tags.
If using CI (Jenkins, GitHub Actions, etc.), ensure:
fetch-depth: 0
If no commits match version rules:
No release needed
-
Simple and predictable
-
Works with real-world commit habits
-
No strict enforcement of commit standards
-
Easy to extend and customize
MIT