Skip to content

Commit c3b8900

Browse files
committed
docs(website): document range-endpoint options and --dry-run
- usage/args.md: list --dry-run, the four range endpoint options, and a "Range selection" section. - configuration/git.md: document the `start_at` / `start_after` / `end_at` / `end_before` keys. - usage/examples.md: examples for the new endpoint options and --dry-run.
1 parent 5916363 commit c3b8900

3 files changed

Lines changed: 111 additions & 0 deletions

File tree

website/docs/configuration/git.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ limit_commits = 42
4242
recurse_submodules = false
4343
include_paths = ["src/", "doc/**/*.md"]
4444
exclude_paths = ["unrelated/"]
45+
46+
# Range selection (optional; mutually exclusive with each other within a pair).
47+
# start_at = "v1.0.0" # include this revision as the lower bound
48+
# start_after = "v0.9.0" # exclude this revision; walk forward from its successor
49+
# end_at = "v2.0.0" # include this revision as the upper bound
50+
# end_before = "v2.1.0" # exclude this revision; stop before it
4551
```
4652

4753
### conventional_commits
@@ -373,3 +379,27 @@ This setting takes priority over `include_paths`.
373379

374380
- If a commit touches both included and excluded paths, it **will be included**.
375381
- If a commit **only** modifies files that match both `include_paths` and `exclude_paths`, it **will be excluded**.
382+
383+
## Range endpoints
384+
385+
Four _optional_ string keys select the commit range explicitly. `start_at` / `start_after` set the lower bound (inclusive / exclusive); `end_at` / `end_before` set the upper bound (inclusive / exclusive). Within each pair, at most one may be set. Any unspecified side falls back to its default (first commit on the left, `HEAD` on the right).
386+
387+
These config keys cannot be combined with the legacy range flags (`--latest`, `--current`, `--unreleased`, `--bump`, positional `A..B`). If a corresponding CLI option is passed, it takes precedence over the config key on the same side.
388+
389+
See the [command-line reference](../usage/args.md#range-selection) for the full surface, including how legacy flags map to endpoint pairs.
390+
391+
### start_at
392+
393+
`start_at` includes the given revision as the lower bound (`[start_at, ...`). The revision itself is part of the output. Any commits before it are excluded.
394+
395+
### start_after
396+
397+
`start_after` excludes the given revision; the walk starts from its successor (`(start_after, ...`). Equivalent to git's `A..` range syntax.
398+
399+
### end_at
400+
401+
`end_at` includes the given revision as the upper bound (`..., end_at]`). The revision itself is part of the output; commits after it are excluded.
402+
403+
### end_before
404+
405+
`end_before` excludes the given revision; the walk stops at its parent (`..., end_before)`). Useful for "everything up to but not including a tag."

website/docs/usage/args.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ git-cliff [FLAGS] [OPTIONS] [--] [RANGE]
2121
--topo-order Sorts the tags topologically
2222
--use-branch-tags Include only the tags that belong to the current branch
2323
--no-exec Disables the external command execution
24+
--dry-run Prints the computed commit range and exits without rendering
2425
-x, --context Prints changelog context as JSON
2526
--use-native-tls Load TLS certificates from the native certificate store
2627
```
@@ -43,6 +44,10 @@ git-cliff [FLAGS] [OPTIONS] [--] [RANGE]
4344
--ignore-tags <PATTERN> Sets the tags to ignore in the changelog [env: GIT_CLIFF_IGNORE_TAGS=]
4445
--count-tags <PATTERN> Sets the tags to count in the changelog [env: GIT_CLIFF_COUNT_TAGS=]
4546
--skip-commit <SHA1>... Sets commits that will be skipped in the changelog [env: GIT_CLIFF_SKIP_COMMIT=]
47+
--start-at <REV> Include this revision as the lower bound (walk forward from here) [env: GIT_CLIFF_START_AT=]
48+
--start-after <REV> Exclude this revision; start walking forward from its successor [env: GIT_CLIFF_START_AFTER=]
49+
--end-at <REV> Include this revision as the upper bound (walk back from here) [env: GIT_CLIFF_END_AT=]
50+
--end-before <REV> Exclude this revision; stop walking before reaching it [env: GIT_CLIFF_END_BEFORE=]
4651
-p, --prepend <PATH> Prepends entries to the given changelog file [env: GIT_CLIFF_PREPEND=]
4752
-o, --output [<PATH>] Writes output to the given file [env: GIT_CLIFF_OUTPUT=]
4853
-t, --tag <TAG> Sets the tag for the latest version [env: GIT_CLIFF_TAG=]
@@ -73,3 +78,48 @@ git-cliff [FLAGS] [OPTIONS] [--] [RANGE]
7378
```
7479
[RANGE] Sets the commit range to process
7580
```
81+
82+
## Range selection
83+
84+
Every git-cliff invocation selects a contiguous slice of history. The flags above are named shortcuts for picking the two endpoints of that slice, with inclusivity baked in. The four `--*-at` / `--*-before` / `--*-after` options make the endpoints (and their inclusivity) explicit.
85+
86+
### New endpoint options
87+
88+
| CLI flag | Config key | Meaning |
89+
| ----------------- | ------------------- | ---------------------------------------- |
90+
| `--start-at X` | `start_at = "X"` | Include `X`; walk forward. `[X, ...` |
91+
| `--start-after X` | `start_after = "X"` | Exclude `X`; walk forward. `(X, ...` |
92+
| `--end-at Y` | `end_at = "Y"` | Include `Y`; walk back. `..., Y]` |
93+
| `--end-before Y` | `end_before = "Y"` | Exclude `Y`; stop before it. `..., Y)` |
94+
95+
The naming convention: `*_at` is inclusive, `*_before` / `*_after` is exclusive. Within each pair, at most one may be set. The two pairs are independent, so any inclusivity combination is expressible. Unspecified sides fall back to the existing defaults (left = first commit, right = `HEAD`).
96+
97+
CLI values override config values on the same side, so a shared team config can be locally overridden without editing the file.
98+
99+
### Conflicts
100+
101+
- `--start-at` and `--start-after` cannot be combined; same for `--end-at` and `--end-before`.
102+
- The new endpoint options cannot be combined with the legacy range flags (`--latest`, `--current`, `--unreleased`, `--bump`, positional `A..B`). Pick one style.
103+
104+
### How legacy flags map to endpoints
105+
106+
| Legacy | Equivalent endpoint form |
107+
| -------------- | ----------------------------------------------------- |
108+
| (no flags) | `--end-at HEAD` (left defaults to first commit) |
109+
| `--unreleased` | `--start-after <last_tag> --end-at HEAD` |
110+
| `--latest` | `--start-after <prev_tag> --end-at <last_tag>` |
111+
| `--current` | `--start-after <prev_tag> --end-at <current_tag>` |
112+
| `<A>..<B>` | `--start-after A --end-at B` |
113+
114+
### Previewing with `--dry-run`
115+
116+
`--dry-run` prints the computed interval, the number of commits it covers, and the git revision range that will be walked, then exits without rendering a changelog:
117+
118+
```
119+
$ git cliff --start-at v0.1.0 --end-at v0.2.0 --dry-run
120+
range: [v0.1.0, v0.2.0]
121+
commits: 3
122+
emitted: 02deb7a7...^..9f14f5d1...
123+
```
124+
125+
The `range:` line uses the revisions you specified (math-interval notation; `[` / `]` are inclusive, `(` / `)` are exclusive). The `emitted:` line shows the git revision range actually passed to the walker, with revisions resolved to full commit SHAs.

website/docs/usage/examples.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,37 @@ git cliff v2.2.1..
4545
git cliff v0.1.0..HEAD
4646
```
4747

48+
Select a range with explicit endpoint inclusivity (`*-at` is inclusive; `*-after` / `*-before` is exclusive):
49+
50+
```bash
51+
# include v1.0.0 itself; walk forward to HEAD
52+
git cliff --start-at v1.0.0
53+
54+
# everything since v1.0.0, but not v1.0.0 itself
55+
git cliff --start-after v1.0.0
56+
57+
# everything up to and including v2.0.0
58+
git cliff --end-at v2.0.0
59+
60+
# strictly between two tags, both excluded
61+
git cliff --start-after v1.0.0 --end-before v2.0.0
62+
```
63+
64+
These options can also be set in `cliff.toml` under `[git]`:
65+
66+
```toml
67+
[git]
68+
start_after = "v1.0.0"
69+
end_at = "v2.0.0"
70+
```
71+
72+
Preview the selection before rendering with `--dry-run`:
73+
74+
```bash
75+
# prints the interval, commit count, and emitted git range; no changelog is written
76+
git cliff --start-at v1.0.0 --end-at v2.0.0 --dry-run
77+
```
78+
4879
Only include the tags from the current branch:
4980

5081
```bash

0 commit comments

Comments
 (0)