@@ -399,6 +399,82 @@ buildmark --validate --results validation-results.trx
399399buildmark --validate --results validation-results.xml
400400```
401401
402+ # Version Selection Rules
403+
404+ BuildMark automatically determines which previous version to use as the baseline when generating build notes. This
405+ section explains how BuildMark selects the baseline version for different scenarios.
406+
407+ ## Pre-Release Versions
408+
409+ For pre-release versions (e.g., ` 1.2.3-beta.1 ` , ` 1.2.3-rc.1 ` ), BuildMark picks the ** previous tag (release or
410+ pre-release) that has a different commit hash** .
411+
412+ This behavior handles cases where multiple pre-release tags point to the same commit (re-tagging scenarios), ensuring
413+ the generated changelog shows actual code changes rather than an empty diff.
414+
415+ ### Example: Pre-Release with Re-Tagged Commits
416+
417+ Consider the following tags:
418+
419+ - ` 1.1.2-rc.1 ` (commit hash: ` a1b2c3d4 ` )
420+ - ` 1.1.2-beta.2 ` (commit hash: ` a1b2c3d4 ` )
421+ - ` 1.1.2-beta.1 ` (commit hash: ` 734713bc ` )
422+
423+ When generating build notes for ` 1.1.2-rc.1 ` :
424+
425+ 1 . BuildMark identifies that ` 1.1.2-beta.2 ` has the same commit hash (` a1b2c3d4 ` )
426+ 2 . BuildMark skips ` 1.1.2-beta.2 ` since it would result in an empty changelog
427+ 3 . BuildMark selects ` 1.1.2-beta.1 ` as the baseline (different commit hash: ` 734713bc ` )
428+
429+ The generated build notes will show changes between ` 1.1.2-beta.1 ` and ` 1.1.2-rc.1 ` .
430+
431+ ## Release Versions
432+
433+ For release versions (e.g., ` 1.2.3 ` ), BuildMark picks the ** previous release tag** , skipping all pre-release versions.
434+
435+ This ensures release notes compare against the previous stable release, showing the complete set of changes since the
436+ last production release.
437+
438+ ### Example: Release Skipping Pre-Releases
439+
440+ Consider the following tags:
441+
442+ - ` 1.1.2 ` (release)
443+ - ` 1.1.2-rc.1 ` (pre-release)
444+ - ` 1.1.2-beta.2 ` (pre-release)
445+ - ` 1.1.2-beta.1 ` (pre-release)
446+ - ` 1.1.1 ` (release)
447+
448+ When generating build notes for ` 1.1.2 ` :
449+
450+ 1 . BuildMark identifies ` 1.1.2 ` as a release version (no pre-release suffix)
451+ 2 . BuildMark skips all pre-release tags (` 1.1.2-rc.1 ` , ` 1.1.2-beta.2 ` , ` 1.1.2-beta.1 ` )
452+ 3 . BuildMark selects ` 1.1.1 ` as the baseline (the previous release)
453+
454+ The generated build notes will show all changes between ` 1.1.1 ` and ` 1.1.2 ` , including changes from all the
455+ pre-release versions.
456+
457+ ## No Previous Version
458+
459+ If no previous version is found (e.g., generating build notes for the first release), BuildMark will build the
460+ history from the beginning of the repository, showing all commits up to the specified version.
461+
462+ ## Version Tag Format
463+
464+ BuildMark recognizes version tags with various formats:
465+
466+ - Simple format: ` 1.2.3 `
467+ - V-prefix: ` v1.2.3 `
468+ - Custom prefixes: ` ver-1.2.3 ` , ` release_1.2.3 `
469+ - Pre-release suffixes: ` -alpha.1 ` , ` -beta.2 ` , ` -rc.1 ` , ` .pre.1 `
470+ - Build metadata: ` +build.123 ` , ` +linux.x64 `
471+
472+ Examples of recognized version tags:
473+
474+ - ` 1.0.0 ` , ` v1.0.0 ` , ` ver-1.0.0 `
475+ - ` 2.0.0-beta.1 ` , ` v2.0.0-rc.2 `
476+ - ` 1.2.3+build.456 ` , ` v2.0.0-rc.1+linux `
477+
402478# Best Practices
403479
404480## Version Tagging
0 commit comments