Skip to main content

init

Initialize versionator in this directory

Initialize versionator by creating a VERSION file.

Creates a VERSION file with the specified initial version and prefix. Optionally creates a .versionator.yaml configuration file.

Only 'v' or 'V' prefixes are allowed per SemVer convention.

Examples:

versionator init                        # Create VERSION with 0.0.1
versionator init --version 1.0.0 # Create VERSION with 1.0.0
versionator init --prefix v # Create VERSION with v0.0.1
versionator init --config # Also create .versionator.yaml
versionator init --force # Overwrite existing files

Usage

versionator init [command] [flags]

Subcommands

CommandDescription
hookInstall post-commit hook for automatic version bumping

hook

Install post-commit hook for automatic version bumping

Install a git post-commit hook that runs 'versionator bump'.

This automatically bumps the VERSION file based on +semver: tags in commit messages and amends the commit to include the VERSION change.

The hook only triggers when the commit message contains: +semver:major - Bump major version +semver:minor - Bump minor version +semver:patch - Bump patch version

Examples:

versionator init hook              # Install the post-commit hook
versionator init hook --uninstall # Remove the post-commit hook
versionator init hook [flags]

Flags:

FlagTypeDefaultDescription
-f, --forceboolfalseOverwrite existing hook
--uninstallboolfalseRemove the post-commit hook

Flags

FlagTypeDefaultDescription
--configboolfalseAlso create .versionator.yaml
-f, --forceboolfalseOverwrite existing files
-p, --prefixstring-Version prefix ('v' or 'V' only)
-v, --versionstring0.0.1Initial version