Commitizen plugin that prefixes commit messages with the common path or prefix of staged files.
Project description
cz-path
Commitizen plugin that prefixes commit messages with the common path or prefix of staged files.
Installation
pip install cz-path
The package depends on Commitizen, so you get the cz command when you install cz-path.
Usage
Configure Commitizen
Point Commitizen at this plugin by setting name to cz_path in your configuration file (see
below). To use this plugin for a single run without changing the config file, pass -n cz_path or
--name cz_path to cz.
Create a commit
-
Use a Git repository. Run
czfrom the repository root. The plugin opens the Git index in the current directory, so running it elsewhere will not see your project. -
Stage your changes with
git add. The plugin looks at the staged diff againstHEADto suggest a path prefix. If nothing is staged, Commitizen fails with a message that no staged files were found. -
Start Commitizen to write the message and create the commit:
cz commitShort form:
cz c. -
Answer the prompts:
- Prefix — pick the suggested path prefix (if shown), or
project, or(empty)for no prefix. - Commit title — the rest of the subject line. The full message is
<prefix>: <title>.
- Prefix — pick the suggested path prefix (if shown), or
Message format
Commits follow <prefix>: <title>, for example module/component: short description of the change.
The pattern is a prefix (which may be empty), then a colon and space, then the title.
By default, src/ is stripped from the computed prefix. Set remove_path_prefixes to [] to turn
that off, or add other path segments (such as a top-level package name) to strip. You do not need to
include a trailing / in each entry.
pyproject.toml
[tool.commitizen]
name = "cz_path"
remove_path_prefixes = ["src", "module_name"]
.cz.json
{
"commitizen": {
"name": "cz_path",
"remove_path_prefixes": ["src", "module_name"]
}
}
Scenarios
| Staged files | Path prefix | String prefix |
|---|---|---|
src/a.c, src/b.c |
src |
src/ |
src/a1.c, src/a2.c |
src |
src/a |
a.c, b.c |
(no option) | (no option) |
If no prefix is found amongst the staged files, only the choices project and empty will be given.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cz_path-0.0.7.tar.gz.
File metadata
- Download URL: cz_path-0.0.7.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0929af7ecab5cd4af65e8656ad031d61259ac2fc027421d1aaffacbcca358464
|
|
| MD5 |
d63009288533dce3b6caa4cd31bf7fa4
|
|
| BLAKE2b-256 |
c24f628329c118c4248b9b45988aa79aef8e41b290b790c546e52ac7e5358d12
|
Provenance
The following attestation bundles were made for cz_path-0.0.7.tar.gz:
Publisher:
publish.yml on Tatsh/cz-path
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cz_path-0.0.7.tar.gz -
Subject digest:
0929af7ecab5cd4af65e8656ad031d61259ac2fc027421d1aaffacbcca358464 - Sigstore transparency entry: 1392464506
- Sigstore integration time:
-
Permalink:
Tatsh/cz-path@ea794f7e901809b0757925eed30ca8ab5dbb49e4 -
Branch / Tag:
refs/tags/v0.0.7 - Owner: https://github.com/Tatsh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ea794f7e901809b0757925eed30ca8ab5dbb49e4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cz_path-0.0.7-py3-none-any.whl.
File metadata
- Download URL: cz_path-0.0.7-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8267528ec7249d9d773b1e0c45c39716635aa7fd34aef892dccbdeff80f7519d
|
|
| MD5 |
3c4c4ff182f747b125b4dbda99c01a1a
|
|
| BLAKE2b-256 |
1c5db3b96ecc99f397ff1d3721cb87de101650cf25dd195103f6d33024e6a220
|
Provenance
The following attestation bundles were made for cz_path-0.0.7-py3-none-any.whl:
Publisher:
publish.yml on Tatsh/cz-path
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cz_path-0.0.7-py3-none-any.whl -
Subject digest:
8267528ec7249d9d773b1e0c45c39716635aa7fd34aef892dccbdeff80f7519d - Sigstore transparency entry: 1392464523
- Sigstore integration time:
-
Permalink:
Tatsh/cz-path@ea794f7e901809b0757925eed30ca8ab5dbb49e4 -
Branch / Tag:
refs/tags/v0.0.7 - Owner: https://github.com/Tatsh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ea794f7e901809b0757925eed30ca8ab5dbb49e4 -
Trigger Event:
push
-
Statement type: