gitnextver
Automatically bump the patch component of a vX.Y.Z git tag, commit all
staged changes, and push — one command to cut a release.
Installation
pip install gitnextver
Or run without installing:
uvx gitnextver
Usage
# Bump patch version in the current directory
gitnextver
# Specify a repository path
gitnextver --directory /path/to/repo
# Verbose output
gitnextver --verbose
# Capture the new version in a script
NEW_VER=$(gitnextver)
echo "Released $NEW_VER"
What it does
Controlled workflows
The original defaults are preserved. Each step can also be controlled:
# Read-only: no fetch/pull, stash, index rewrite, commit, tag or push
gitnextver --dry-run --initial=v2.1.0
# Tag the existing clean HEAD locally, without pulling or committing
gitnextver --commit=False --pull=False --push=False --initial=v2.1.0
# Choose which component to increment
gitnextver --bump=minor
gitnextver --bump=major
--initial applies only when there are no canonical vX.Y.Z tags. Minor and
major bumps reset smaller components to zero. Host suffixes, prereleases and
leading-zero tags are ignored. Options are validated before any mutations.
Pushes send only the current branch and selected tag, atomically; a rejected
push exits nonzero and retains the local commit/tag for manual recovery.
An atomic push requires a server that supports it. Existing tags are never moved.
For automation that owns Git itself, use the pure API (no Git/network calls):
from gitnextver.versioning import next_version
assert next_version([], initial="v2.1.0") == "v2.1.0"
assert next_version(["v2.1.9"], bump="minor") == "v2.2.0"
Default workflow
- Validates that the working directory is a git repository.
- Checks the git index format and rewrites to version 2 if GitPython requires it (see Troubleshooting).
- Stashes uncommitted/untracked changes so the pull step can proceed.
- Pulls from the configured remote (skipped when no remote exists).
- Re-applies the stash.
- Finds the highest
vMAJOR.MINOR.PATCHtag, incrementsPATCHby one. Defaults tov1.0.0when no version tags exist. - Stages all changes, commits with the version string as the commit message, creates the tag, and pushes.
What it does NOT do
- Generate a changelog or release notes.
- Write a version number into source files.
- Create GitHub/GitLab releases.
- Honour conventional commits or commit linting.
Use --bump=minor or --bump=major for larger version changes.
Troubleshooting
Git index lock (could not write index)
A stale .git/index.lock file from a previous interrupted git operation can
block stashing or committing. Fix:
rm -f .git/index.lock
git reset --mixed
GitPython index version error
Git 2.20+ and the Xcode CLI tools on macOS can write index format version 3
or 4, which GitPython does not support. gitnextver detects and rewrites the
index automatically. If the automatic rewrite fails, run:
git update-index --index-version=2
License
Apache-2.0
Metadata
Release files for gitnextver 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gitnextver-1.0.4.tar.gz | 30.2 kB | Without provenance | Details for gitnextver-1.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gitnextver-1.0.4-py3-none-any.whl | Python 3 | none | any | Details for gitnextver-1.0.4-py3-none-any.whl |
Total release size: 45.6 kB
Release files / gitnextver-1.0.4.tar.gz
| Download URL | gitnextver-1.0.4.tar.gz |
|---|---|
| Size | 30.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
03b9b8665f0dec4e1654e00bd0e35c78c6d137f0aac3c46c894fbc0995ba0b98
|
|
BLAKE2b-256 checksum How to use checksums |
49b1de80d4de8ffc81ba8f1edec3f3b8a68341d072fc59f3cf05697650679a59
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.18 {"installer":{"name":"uv","version":"0.12.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / gitnextver-1.0.4-py3-none-any.whl
| Download URL | gitnextver-1.0.4-py3-none-any.whl |
|---|---|
| Size | 15.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7fa279aeec305dde6438acecf496f2d72b21320f05aba9e87b686d4c277e863b
|
|
BLAKE2b-256 checksum How to use checksums |
510448983da6c4a0cbab03a4cedeec706e0a630291a76e973b314e8754a92361
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.18 {"installer":{"name":"uv","version":"0.12.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for gitnextver 1.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.