No description
  • Go 99.3%
  • Pkl 0.7%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Tim Hårek Andreassen f56211d1aa
All checks were successful
check / check (push) Successful in 31s
ci: Trigger workflow against fixed mise-runner image
2026-09-11 12:21:54 +02:00
.forgejo/workflows ci: Drop the GITHUB_TOKEN unset; mise-runner image handles it now 2026-09-11 12:15:31 +02:00
cmd/git-bump Require confirmation before undo deletes a tag 2026-09-10 23:10:01 +02:00
convention convention: Omit micro segment on first release of a new month 2026-09-01 10:43:29 +02:00
internal/cmd build: Add mise and hk 2026-08-11 22:13:00 +02:00
.gitbump.toml chore: Do not autopush 2026-09-01 10:44:07 +02:00
.gitignore dev: Add gitignore 2025-05-22 21:59:25 +02:00
.golangci.toml dev: Add check 2025-07-02 21:18:54 +02:00
AGENTS.md docs: Rename CLAUDE.md to AGENTS.md 2026-08-28 14:34:12 +02:00
bump.go Add --hash flag to tag a specific commit 2026-09-10 21:05:43 +02:00
bump_test.go Add --hash flag to tag a specific commit 2026-09-10 21:05:43 +02:00
config.go build: Move module path to src.timharek.no/tim/git-bump 2026-09-09 21:54:03 +02:00
config_test.go refactor: Replace viper with go-toml and slim convention API 2026-08-28 12:03:28 +02:00
go.mod build: Move module path to src.timharek.no/tim/git-bump 2026-09-09 21:54:03 +02:00
go.sum refactor: Replace viper with go-toml and slim convention API 2026-08-28 12:03:28 +02:00
hk.pkl build: Add mise and hk 2026-08-11 22:13:00 +02:00
LICENSE.md Add license 2025-05-22 22:13:13 +02:00
mise.toml ci: Migrate from Sourcehut builds to Forgejo Actions 2026-09-11 11:48:56 +02:00
README.md Require confirmation before undo deletes a tag 2026-09-10 23:10:01 +02:00
schema.json feat: Add custom version schemas 2025-07-11 20:17:03 +02:00

git-bump

Easily tag new versions with git using configurable versioning conventions.

Features

  • Multiple Versioning Conventions: Support for semantic versioning (semver) and calendar versioning (calver)
  • Configurable: Use .gitbump.toml configuration files for project-specific settings
  • Flexible Prefixes: Customize version prefixes (v, release, etc.)
  • Auto-increment: Intelligent version incrementing based on convention type
  • Git Integration: Seamless git tag creation and management

Install CLI

Using go:

go install src.timharek.no/tim/git-bump/cmd/git-bump@latest

Using Homebrew

brew tap timharek/tap
brew install git-bump

Adding more methods in the future. Help is wanted to achieve the best coverage.

Using pre-compiled binary

Select the version you want to install [available releases] and download it and add it to your bin or something similar.

Example:

wget https://src.timharek.no/tim/git-bump/releases/download/<release>/git-bump-<version>-linux-amd64.tar.gz
tar xf git-bump-<version>-linux-amd64.tar.gz
cd git-bump-<version>
cp git-bump /usr/local/bin

Configuration

Initialize a configuration file in your git repository:

git bump init

This creates a .gitbump.toml file with default settings:

[versioning]
convention = 'semver'
prefix = 'v'
format = '{major}.{minor}.{patch}'
timezone = 'UTC'

[git]
remote = 'origin'
auto_push = false

[messages]
use_shortlog = false
custom_messages = []

Versioning Conventions

Semantic Versioning (semver)

  • Convention: semver
  • Format: {major}.{minor}.{patch} (only this format is supported)
  • Increment types: major, minor, patch
  • Example: v1.2.3

Calendar Versioning (calver)

  • Convention: calver
  • Formats:
    • YYYY.MM.DD (date-based)
    • YY.MM.DD (short year)
    • YYYY.MM.MICRO (with micro increments)
    • YY.MM.MICRO (short year with micro)
  • Increment types: date, micro
  • Examples: release2025.07.11, v25.07.15

Configuration Hierarchy

git-bump searches for configuration files in this order:

  1. .gitbump.toml in the current directory
  2. $XDG_CONFIG_HOME/git-bump/gitbump.toml (macOS: ~/Library/Application Support/git-bump/gitbump.toml)
  3. ~/.config/git-bump/gitbump.toml
  4. ~/gitbump.toml

The local file is named .gitbump.toml, global ones gitbump.toml. TOML is the only supported format. The first file found wins; it is not merged with the others.

Settings can also be overridden with environment variables prefixed with GITBUMP_, e.g. GITBUMP_GIT_AUTO_PUSH=true or GITBUMP_VERSIONING_CONVENTION=calver.

Show the effective configuration, including where it was loaded from:

git bump config

Verify that the loaded configuration is valid (parses, and the convention, format, and timezone are accepted):

git bump check

Usage

# Get help
git bump -h

# Bump version (uses convention-specific default increment)
git bump
# Asks for confirmation before creating the tag; prints just the new tag:
# v0.0.1 (semver) or release2025.07.11 (calver)

# Skip the confirmation prompt (use in scripts)
git bump --force

# Bump version and include shortlog between current commit and previous tag
git bump --shortlog

# Bump version with message(s)
git bump --message "Feat 1" --message "Fix 2"

# Bump specific component (semver)
git bump --minor   # v0.1.0
git bump --major   # v1.0.0
git bump --patch   # v0.0.1

# Show latest version
git bump latest

# List all version tags
git bump list

# Undo (delete) latest tag
git bump undo

# Undo (delete) tag from remote origin
git bump undo --remote origin

# Skip the confirmation prompt
git bump undo --force

# Push tag to remote
git bump push

Convention-Specific Behavior

Semantic Versioning:

  • Bumping minor resets patch to 0
  • Bumping major resets minor and patch to 0
  • Default increment: patch

Calendar Versioning:

  • Date format: Updates to current date
  • Micro format: Restarts the micro cycle each month — the first release of a month has no micro segment (vYYYY.MM), later releases increment it (vYYYY.MM.1, vYYYY.MM.2, ...). This also applies when the previous tag was day-based, e.g. from an earlier YYYY.MM.DD format.
  • Default increment: date (for YYYY.MM.DD) or micro (for YYYY.MM.MICRO)

Examples

Semver Project

git bump init
# Edit .gitbump.toml: convention = 'semver', prefix = 'v'
git bump          # v0.0.1
git bump --minor  # v0.1.0
git bump --major  # v1.0.0

Calver Project

git bump init
# Edit .gitbump.toml: convention = 'calver', prefix = 'release', format = 'YYYY.MM.DD'
git bump  # release2025.07.11
git bump  # release2025.07.11 (same day, increments to current date)

Calver with Micro Increments

# Edit .gitbump.toml: convention = 'calver', format = 'YYYY.MM.MICRO'
git bump  # v2025.07.1
git bump  # v2025.07.2 (same month, increments micro)

Things to know

  • --help will not work when running in git bump, but will work in git-bump.
  • Configuration settings override command-line defaults
  • Each versioning convention has its own increment logic and options