File: cz-path.md

package info (click to toggle)
commitizen 4.10.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,892 kB
  • sloc: python: 17,728; makefile: 15
file content (54 lines) | stat: -rw-r--r-- 1,139 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# [cz-path](https://pypi.org/project/cz-path/)

Provides prefix choices for commit messages based on staged files (Git only).
For example, if the staged files are `component/z/a.ts` and `component/z/b.ts`,
the path prefix option will be `component/z` and commit message might look like:
`component/z/: description of changes`. If only one file is staged, the extension
is removed in the prefix.

This plugins provides a commitizen convention for commit messages.

## Installation

```sh
pip install cz-path
```

## Usage

Add `cz-path` to your configuration file.

Example for `.cz.json`:

```json
{
  "commitizen": {
    "name": "cz_path",
    "remove_path_prefixes": ["src", "module_name"]
  }
}
```

The default value for `remove_path_prefixes` is `["src"]`. Adding `/` to the
prefixes is not required.

## Example session

```plain
 $ git add .vscode/
 $ cz -n cz_path c
? Prefix: (Use arrow keys)
 ยป .vscode
   .vscode/
   project
   (empty)
? Prefix: .vscode
? Commit title: adjust settings

.vscode: adjust settings

[main 0000000] .vscode: adjust settings
 2 files changed, 1 insertion(+), 11 deletions(-)

Commit successful!
```