Repository navigation
2nd git.commit error: "On branch main nothing to commit, working tree clean" #1530
Description
Activity
- addedos: macOShas issue on macOShas issue on macOS
on Jun 10, 2025 With
update_changelog_on_bump = true, it works fine, but this is a valid bug. Thanks for reporting!Reacted by Tuukka MustonenThis came to light while building a workaround for #883
Since I can't use the changelog due to this bug I run
cz bumpwithout--changelog/update_changelog_on_bump = trueThere's a PR open supposed to fix this
#996Reacted by Christian Lölkesoh.... I'll see whether I can make it merged in the next release
Reacted by Christian LölkesTriage from #1964: Confirmed still valid on master (4.15.1).
commitizen/commands/bump.py(lines 385-394) callsgit commit -aand treats a non-zero return code as fatal. Withversion_provider = "scm"and noversion_files/ changelog updates, there's nothing for the bump commit to include, so git exits with "nothing to commit". Fix should detect this case (e.g., checkis_staging_clean()before commit, or treat the "nothing to commit" return code gracefully) and skip the bump commit, just creating the tag onHEAD.Verification update (re #1964)
Reproduced against current master (4.15.1):
Config:
version_provider = "scm"only, no version_files, no changelog updates.After staging
cz.tomland committingfeat: initial, runningcz bump --yesexits 6 with:bump: version 0.0.0 → 0.1.0 tag to create: 0.1.0 increment detected: MINOR 2nd git.commit error: "On branch main nothing to commit, working tree clean "No tag is created. Even the first bump fails because there are no files to update.
Verdict: STILL VALID — and slightly worse than the original report, which had the first bump succeed (probably because of
cz.tomlmodifications by older commitizen versions).Suggested fix in
commitizen/commands/bump.py:- Before calling
git.commit(...), check whether anything is staged (git.is_staging_clean()). - If clean, skip the commit and just create the tag on
HEAD. - This naturally handles the
version_provider = "scm"no-op-bump case without requiring users to setupdate_changelog_on_bump.
- Before calling
- added a commit that references this issue
on Sep 29, 2026
Description
Commitizen fails if
version_provideris set toscmand no files are changed (no changelog, no version number in files) a version bumpSteps to reproduce
git init testand change into itcd testcz.tomlgit add cz.tomlandcz commitcz bumpbump: version 0.0.0 → 0.0.1 tag to create: 0.0.1 increment detected: PATCH [main 16e057b] bump: version 0.0.0 → 0.0.1 1 file changed, 1 insertion(+), 1 deletion(-) Done!touch foobar,git add foobarandcz commitcz bumpIf I run
cz bump --changelogthe second time, there is no error.Current behavior
cz bumpfails if no changes (updated changelog, version number in files) are made during a version bump.Desired behavior
cz bumpshould not fail if no changes (updated changelog, version number in files) are made during a version bump.Screenshots
No response
Environment
Commitizen Version: 4.8.2
Python Version: 3.13.4 (main, Jun 3 2025, 15:34:24) [Clang 17.0.0 (clang-1700.0.13.3)]
Operating System: Darwin