Skip to content

fix(commit): emit deprecated warning of cz commit -s BEFORE going through dialog, add deprecation warning on cz commit --help #1491

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions commitizen/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def __call__(
{
"name": ["-s", "--signoff"],
"action": "store_true",
"help": "sign off the commit",
"help": "Deprecated, use 'cz commit -- -s' instead",
},
{
"name": ["-a", "--all"],
Expand Down Expand Up @@ -347,7 +347,7 @@ def __call__(
},
{
"name": ["--version-type"],
"help": "Deprecated, use --version-scheme",
"help": "Deprecated, use --version-scheme instead",
"default": None,
"choices": version_schemes.KNOWN_SCHEMES,
},
Expand Down
10 changes: 5 additions & 5 deletions commitizen/commands/commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ def __call__(self) -> None:
write_message_to_file = self.arguments.get("write_message_to_file")
signoff = bool(self.arguments.get("signoff"))

if signoff:
out.warn(
"Deprecated warning: `cz commit -s` is deprecated and will be removed in v5, please use `cz commit -- -s` instead."
)

if self.arguments.get("all"):
git.add("-u")

Expand All @@ -147,11 +152,6 @@ def __call__(self) -> None:
if dry_run:
raise DryRunExit()

if signoff:
out.warn(
"signoff mechanic is deprecated, please use `cz commit -- -s` instead."
)

if self.config.settings["always_signoff"] or signoff:
extra_args = f"{extra_args} -s".strip()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ options:
--version-scheme {pep440,semver,semver2}
choose version scheme
--version-type {pep440,semver,semver2}
Deprecated, use --version-scheme
Deprecated, use --version-scheme instead
--build-metadata BUILD_METADATA
Add additional build-metadata to the version-number
--get-next Determine the next version and write to stdout
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ options:
--write-message-to-file FILE_PATH
write message to file before committing (can be
combined with --dry-run)
-s, --signoff sign off the commit
-s, --signoff Deprecated, use 'cz commit -- -s' instead
-a, --all Tell the command to automatically stage files that
have been modified and deleted, but new files you have
not told Git about are not affected.
Expand Down