Skip to content

Commit 9b40799

Browse files
committed
docs(changelog): update information about using changelog command
1 parent 7cfb4e5 commit 9b40799

File tree

1 file changed

+77
-8
lines changed

1 file changed

+77
-8
lines changed

docs/changelog.md

Lines changed: 77 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,28 @@ This command will generate a changelog following the commiting rules established
44

55
## Usage
66

7-
In the command line run
7+
```bash
8+
$ cz changelog --help
9+
usage: cz changelog [-h] [--dry-run] [--file-name FILE_NAME]
10+
[--unreleased-version UNRELEASED_VERSION] [--incremental]
11+
[--start-rev START_REV]
12+
13+
optional arguments:
14+
-h, --help show this help message and exit
15+
--dry-run show changelog to stdout
16+
--file-name FILE_NAME
17+
file name of changelog (default: 'CHANGELOG.md')
18+
--unreleased-version UNRELEASED_VERSION
19+
set the value for the new version (use the tag value),
20+
instead of using unreleased
21+
--incremental generates changelog from last created version, useful
22+
if the changelog has been manually modified
23+
--start-rev START_REV
24+
start rev of the changelog.If not set, it will
25+
generate changelog from the start
26+
```
27+
28+
### Examples
829
930
```bash
1031
cz changelog
@@ -14,15 +35,9 @@ cz changelog
1435
cz ch
1536
```
1637
17-
It has support for incremental changelog:
18-
19-
- Build from latest version found in changelog, this is useful if you have a different changelog and want to use chommitizen
20-
- Update unreleased area
21-
- Allows users to manually touch the changelog without being rewritten.
22-
2338
## Constrains
2439
25-
At the moment this features is constrained only to markdown files.
40+
changelog generation is constrained only to **markdown** files.
2641
2742
## Description
2843
@@ -55,6 +70,60 @@ and the following variables are expected:
5570
5671
- **required**: is the only one required to be parsed by the regex
5772
73+
## Configuration
74+
75+
### `unreleased_version`
76+
77+
There is usually an egg and chicken situation when automatically
78+
bumping the version and creating the changelog.
79+
If you bump the version first, you have no changelog, you have to
80+
create it later, and it won't be included in
81+
the release of the created version.
82+
83+
If you create the changelog before bumping the version, then you
84+
usually don't have the latest tag, and the _Unreleased_ title appears.
85+
86+
By introducing `unreleased_version` you can prevent this situation.
87+
88+
Before bumping you can run:
89+
90+
```bash
91+
cz changelog --unreleased_version="v1.0.0"
92+
```
93+
94+
Remember to use the tag instead of the raw version number
95+
96+
For example if the format of your tag includes a `v` (`v1.0.0`), then you should use that,
97+
if your tag is the same as the raw version, then ignore this.
98+
99+
Alternatively you can directly bump the version and create the changelog by doing
100+
101+
```bash
102+
cz bump --changelog
103+
```
104+
105+
### `file-name`
106+
107+
This value can be updated in the `toml` file with the key `changelog_file` under `tools.commitizen`
108+
109+
Specify the name of the output file, remember that changelog only works with markdown.
110+
111+
```bash
112+
cz changelog --file-name="CHANGES.md"
113+
```
114+
115+
### `incremental`
116+
117+
Benefits:
118+
119+
- Build from latest version found in changelog, this is useful if you have a different changelog and want to use commitizen
120+
- Update unreleased area
121+
- Allows users to manually touch the changelog without being rewritten.
122+
123+
```bash
124+
cz changelog --incremental
125+
```
126+
58127
## TODO
59128
60129
- [ ] support for hooks: this would allow introduction of custom information in the commiter, like a github or jira url. Eventually we could build a `CzConventionalGithub`, which would add links to commits

0 commit comments

Comments
 (0)