CLI reference#

$ bumpversion --help
 
bump git version
 
Usage: bumpversion [OPTIONS] [ARGS]... [COMMAND]
 
Commands:
  major
  minor
  patch
  show
  show-bump
  bump
  help       Print this message or the help of the given subcommand(s)
 
Arguments:
  [ARGS]...
 
Options:
      --dir <DIR>
          repository directory to run bumpversion in [env: BUMPVERSION_DIR=]
      --config-file <CONFIG_FILE>
          config file to read most of the variables from [env: BUMPVERSION_CONFIG_FILE=]
      --color <COLOR_CHOICE>
          enable or disable color [env: BUMPVERSION_COLOR=]
  -v, --verbose...
          Increase logging verbosity
  -q, --quiet...
          Decrease logging verbosity
      --log <LOG_LEVEL>
          Log level. When using a more sophisticated logging setup using RUST_LOG environment variable, this option is overwritten. [env: BUMPVERSION_LOG_LEVEL=]
      --allow-dirty
          don't abort if working directory is dirty [env: BUMPVERSION_ALLOW_DIRTY=]
      --no-allow-dirty
          explicitly abort if dirty [env: BUMPVERSION_NO_ALLOW_DIRTY=]
      --current-version <CURRENT_VERSION>
          version that needs to be updated [env: BUMPVERSION_CURRENT_VERSION=]
      --new-version <NEW_VERSION>
          new version that should be in the files [env: BUMPVERSION_NEW_VERSION=]
      --parse <PARSE_VERSION_PATTERN>
          regex parsing the version string [env: BUMPVERSION_PARSE=]
      --serialize <SERIALIZE_VERSION_PATTERNS>
          how to format what is parsed back to a version [env: BUMPVERSION_SERIALIZE=]
      --search <SEARCH>
          template for complete string to search [env: BUMPVERSION_SEARCH=]
      --replace <REPLACE>
          template for complete string to replace [env: BUMPVERSION_REPLACE=]
      --regex
          treat the search parameter as a regular expression [env: BUMPVERSION_REGEX=]
      --no-regex
          explicitly do not treat the search parameter as a regular expression [env: BUMPVERSION_NO_REGEX=]
      --no-configured-files
          only replace the version in files specified on the command line, ignoring the files from the configuration file [env: BUMPVERSION_NO_CONFIGURED_FILES=]
      --ignore-missing-files
          ignore any missing files when searching and replacing in files [env: BUMPVERSION_IGNORE_MISSING_FILES=]
      --no-ignore-missing-files
          do not allow missing files when searching and replacing in files [env: BUMPVERSION_NO_IGNORE_MISSING_FILES=]
      --ignore-missing-version
          ignore any missing versions when searching and replacing in files [env: BUMPVERSION_IGNORE_MISSING_VERSION=]
      --no-ignore-missing-version
          do not allow missing versions when searching and replacing in files [env: BUMPVERSION_NO_IGNORE_MISSING_VERSION=]
  -n, --dry-run
          don't write any files, just pretend. [env: BUMPVERSION_DRY_RUN=]
      --commit
          commit to version control [env: BUMPVERSION_COMMIT=]
      --no-commit
          do not commit to version control [env: BUMPVERSION_NO_COMMIT=]
      --tag
          create a tag in version control [env: BUMPVERSION_TAG=]
      --no-tag
          do not create a tag in version control [env: BUMPVERSION_NO_TAG=]
      --sign-tags
          sign tags if created [env: BUMPVERSION_SIGN_TAGS=]
      --no-sign-tags
          do not sign tags if created [env: BUMPVERSION_NO_SIGN_TAGS=]
      --tag-name <TAG_NAME>
          tag name (only works with --tag) [env: BUMPVERSION_TAG_NAME=]
      --tag-message <TAG_MESSAGE>
          tag message [env: BUMPVERSION_TAG_MESSAGE=]
  -m, --message <COMMIT_MESSAGE>
          commit message [env: BUMPVERSION_MESSAGE=]
      --commit-args <COMMIT_ARGS>
          extra arguments to commit command [env: BUMPVERSION_COMMIT_ARGS=]
  -h, --help
          Print help
  -V, --version
          Print version

Every flag below is global: accepted at the top level and on every subcommand alike. Each also has an environment variable, named BUMPVERSION_ plus the flag in upper snake case.

General#

FlagValueDescription
--dirpathRepository directory to run in
--colorauto, always, always-ansi, neverEnable or disable color. Defaults to auto, which is on only when stdout is a terminal
-v, --verboserepeatableIncrease verbosity
-q, --quietrepeatableDecrease verbosity
--loglevelTracing log level. Also accepted as --log-level
-h, --helpPrint help
-V, --versionPrint version

Version#

FlagValueDescription
--current-versionstringVersion to bump from, overriding the config
--new-versionstringVersion to write, skipping component selection
--parseregexRegex parsing the version string
--serializestringHow to format components back into a version. Repeatable

Files#

FlagValueDescription
--searchtemplateString to search for
--replacetemplateString to replace it with
--no-configured-filesflagOnly rewrite files named on the command line
--ignore-missing-files / --no-ignore-missing-filesflagWhether a missing file is an error
--ignore-missing-version / --no-ignore-missing-versionflagWhether a missing version in a file is an error

Version control#

FlagValueDescription
-n, --dry-runflagWrite nothing; just report
--allow-dirty / --no-allow-dirtyflagWhether to proceed on an unclean working tree
--commit / --no-commitflagWhether to commit
--tag / --no-tagflagWhether to tag
--sign-tags / --no-sign-tagsflagWhether to sign the tag
--tag-nametemplateTag name
-m, --messagetemplateCommit message
--commit-argsstringExtra arguments for git commit

Each --x / --no-x pair overrides the corresponding config key for one run; without either, the config value stands.

Verbosity#

The report is off by default. This is the single most surprising thing about the tool:

FlagsOutput
(none)Nothing. A successful bump is completely silent
-vThe full report: versions, per-file diffs, commit, tag, hooks
-vvAdds the per-component breakdown under each version
-vvv and aboveAccepted, identical to -vv
-qSame as the default

-q and -v cannot be combined; doing so is a usage error.

--log is separate: it controls tracing diagnostics from the library, not the report. It defaults to WARN, which is why a mismatch between the configured version and the last tag shows up even in an otherwise silent run:

WARN bumpversion::common: version 1.4.2 from config does not match last tagged version (1.4.3)

RUST_LOG overrides --log when set, taking the same directive syntax as any tracing filter — RUST_LOG=bumpversion=debug.

Exit codes#

CodeMeaning
0Success. Also --help, --version, and a show with an unknown variable
1The run failed — no config file, unclean tree, unknown component, a hook that failed
2The command line could not be parsed — unknown flag, bad --color value, missing component

Nothing finer distinguishes the failure modes, so a script that needs to tell “dirty tree” from “missing config” has to match on the message.

Common exit-1 messages:

MessageCause
missing config fileNo recognized config file in the directory
Working directory is not clean:Uncommitted changes; pass --allow-dirty
missing version component to bumpNo component given and no --new-version
missing current versionNo current_version in the config or on the command line
failed to parse current versioncurrent_version does not match the parse pattern
the component has already the maximum value ...A values component is already at its last entry

Requirements#

bumpversion opens the Git repository before doing anything, so every command — including show — must run inside one.