Skip to content

Commit 690590e

Browse files
committed
docs: add prerelease collision avoidance to README
Update readme explaining how --prerelease automatically increments the numeric suffix when a tag already exists for the same base version and prerelease channel.
1 parent 30ff7bd commit 690590e

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,20 @@ npm run release -- --prerelease alpha
284284

285285
This will tag the version as: `1.0.1-alpha.0`
286286

287+
#### Prerelease Tag Collision Avoidance
288+
289+
When cutting a prerelease with `--prerelease`, `commit-and-tag-version` automatically checks existing git tags (respecting your `tagPrefix` configuration) for the same base version and prerelease channel. If a tag already exists, the numeric suffix is automatically incremented to avoid conflicts.
290+
291+
For example, if you're working with multiple prerelease channels simultaneously:
292+
293+
```bash
294+
commit-and-tag-version --prerelease xyz # Creates v1.4.3-xyz.0
295+
commit-and-tag-version --prerelease abc # Creates v1.4.3-abc.0
296+
commit-and-tag-version --prerelease xyz # Creates v1.4.3-xyz.1 (auto-incremented)
297+
```
298+
299+
This behavior applies to both named prereleases (e.g., `-alpha.0`, `-beta.1`) and unnamed prereleases (e.g., `-0`, `-1`), ensuring that you can safely cut multiple prerelease versions without encountering git tag conflicts.
300+
287301
### Release as a Target Type Imperatively (`npm version`-like)
288302

289303
To forgo the automated version bump use `--release-as` with the argument `major`, `minor` or `patch`.

0 commit comments

Comments
 (0)