Debian Codegraph @

docs/third-party-plugins/cz-path.md

raw
1 # [cz-path](https://pypi.org/project/cz-path/)
2
3 Provides prefix choices for commit messages based on staged files (Git only).
4 For example, if the staged files are `component/z/a.ts` and `component/z/b.ts`,
5 the path prefix option will be `component/z` and commit message might look like:
6 `component/z/: description of changes`. If only one file is staged, the extension
7 is removed in the prefix.
8
9 This plugins provides a commitizen convention for commit messages.
10
11 ## Installation
12
13 ```sh
14 pip install cz-path
15 ```
16
17 ## Usage
18
19 Add `cz-path` to your configuration file.
20
21 Example for `.cz.json`:
22
23 ```json
24 {
25 "commitizen": {
26 "name": "cz_path",
27 "remove_path_prefixes": ["src", "module_name"]
28 }
29 }
30 ```
31
32 The default value for `remove_path_prefixes` is `["src"]`. Adding `/` to the
33 prefixes is not required.
34
35 ## Example session
36
37 ```plain
38 $ git add .vscode/
39 $ cz -n cz_path c
40 ? Prefix: (Use arrow keys)
41 ยป .vscode
42 .vscode/
43 project
44 (empty)
45 ? Prefix: .vscode
46 ? Commit title: adjust settings
47
48 .vscode: adjust settings
49
50 [main 0000000] .vscode: adjust settings
51 2 files changed, 1 insertion(+), 11 deletions(-)
52
53 Commit successful!
54 ```