Summary
In GitFlow, a hotfix released on an older line (e.g. 1.1.1) must be merged back up into develop so the fix is present there. As soon as that hotfix tag becomes reachable from develop, GitVersion picks it as the VersionSource, and CommitsSinceVersionSource is recomputed from that later tag. Because the hotfix tag sits after the previous baseline, the pre-release counter on develop decreases, so the emitted version goes backwards (e.g. 1.2.0-beta.168 → 1.2.0-beta.91).
This is not just cosmetic: on an append-only integration branch the counter later climbs again and re-emits pre-release versions that were already published with different content (1.2.0-beta.91 … 168 a second time), which causes package-feed collisions (NuGet treats identical version strings as the same package).
Environment
- GitVersion 6.5.1 (GitVersion.MsBuild),
workflow: GitFlow/v1
develop labeled beta; integration branches are append-only (no squash/rebase), hotfixes are merged up as required by GitFlow.
Reproduction
# main has the last minor release, merged into develop; develop => 1.2.0-beta.N
git tag 1.1.0
# ... many commits on develop ... => 1.2.0-beta.<large N>
# hotfix on the released 1.1 line
git checkout main && git switch -c hotfix/1.1.1
git commit -am "fix"
git switch main && git merge --no-ff hotfix/1.1.1 && git tag 1.1.1
# merge the fix UP into develop (mandatory in GitFlow, so the fix is in develop)
git switch develop && git merge --no-ff main
develop now reports 1.2.0-beta.M with M = commits since 1.1.1, which is smaller than the previous N (commits since 1.1.0).
Actual behavior
VersionSource moves from 1.1.0 to 1.1.1; CommitsSinceVersionSource drops → the develop pre-release number regresses and can later collide with already-published versions.
Expected / requested behavior
develop's counting anchor should be the point where the current line was established — i.e. the commit where develop incremented to its current version (typically where the last release/* branch was derived) — independent of older-line tags that are merged up afterwards. In other words, a tag whose Major.Minor is below the version develop is currently working towards should not become develop's VersionSource.
This would keep the merged-up fix present in develop (commits merged) while keeping the pre-release number monotonic (tag not used as counting anchor).
Current workaround (and why it's insufficient)
ignore.sha for each hotfix tag works, but requires a manual entry per hotfix; there is no rule/regex to exclude "tags below the current line" automatically. next-version does not help (verified: VersionSource still moves to the hotfix tag). A configurable behavior (e.g. "anchor develop to the line's branch-off point" / "ignore version sources below the target Major.Minor") would solve this generally.
Summary
In GitFlow, a hotfix released on an older line (e.g.
1.1.1) must be merged back up intodevelopso the fix is present there. As soon as that hotfix tag becomes reachable fromdevelop, GitVersion picks it as theVersionSource, andCommitsSinceVersionSourceis recomputed from that later tag. Because the hotfix tag sits after the previous baseline, the pre-release counter ondevelopdecreases, so the emitted version goes backwards (e.g.1.2.0-beta.168→1.2.0-beta.91).This is not just cosmetic: on an append-only integration branch the counter later climbs again and re-emits pre-release versions that were already published with different content (
1.2.0-beta.91 … 168a second time), which causes package-feed collisions (NuGet treats identical version strings as the same package).Environment
workflow: GitFlow/v1developlabeledbeta; integration branches are append-only (no squash/rebase), hotfixes are merged up as required by GitFlow.Reproduction
developnow reports1.2.0-beta.MwithM = commits since 1.1.1, which is smaller than the previousN(commits since 1.1.0).Actual behavior
VersionSourcemoves from1.1.0to1.1.1;CommitsSinceVersionSourcedrops → thedeveloppre-release number regresses and can later collide with already-published versions.Expected / requested behavior
develop's counting anchor should be the point where the current line was established — i.e. the commit wheredevelopincremented to its current version (typically where the lastrelease/*branch was derived) — independent of older-line tags that are merged up afterwards. In other words, a tag whoseMajor.Minoris below the versiondevelopis currently working towards should not becomedevelop'sVersionSource.This would keep the merged-up fix present in
develop(commits merged) while keeping the pre-release number monotonic (tag not used as counting anchor).Current workaround (and why it's insufficient)
ignore.shafor each hotfix tag works, but requires a manual entry per hotfix; there is no rule/regex to exclude "tags below the current line" automatically.next-versiondoes not help (verified:VersionSourcestill moves to the hotfix tag). A configurable behavior (e.g. "anchor develop to the line's branch-off point" / "ignore version sources below the target Major.Minor") would solve this generally.