Skip to content

[ISSUE]: Unable to make versioning work in release/hotfix branches despite many efforts #4906

Description

@xumix

Prerequisites

  • I have written a descriptive issue title
  • I have searched issues to ensure it has not already been reported

GitVersion package

GitVersion.Tool

GitVersion version

6.7.0

Operating system

Windows

What are you seeing?

It looks like VersionInBranchNameVersionStrategy is skipped (or not prioritized properly) when running in release or hotfix branches for me.

What is expected?

For example, if I'm in the branch hotfix/Hotfix-2026.04.01 I'd like the SemVersion to look like 2026.4.1-beta.1+9, same for release. Instead I'm getting the verion from the last tagged master commit like 2026.3.30-beta.1+9.
Changing is-release-branch makes no difference at all.
What am I doing wrong?
Full config, gitversion log and git log are attached.

Steps to Reproduce

Create a master branch, tag some commit with Hotfix-2026.03.30
create a new hotfix branch like hotfix/Hotfix-2026.04.01
run gitversion with the config:

assembly-versioning-scheme: MajorMinorPatchTag
version-in-branch-pattern: .*?-?(?<version>[vV]?\d+(\.\d+)?(\.\d+)?).*
tag-prefix: "([Vv]|[Rr]elease-|[Hh]otfix-)"
semantic-version-format: Loose
branches:
  develop:
    label : alpha
    increment: Patch
  main:
    source-branches:
      - develop
      - release
      - hotfix
    is-release-branch: true
  release:
    label: beta
    increment: None
    is-release-branch: true
    source-branches:
      - main
      - support
      - hotfix
  hotfix:
    increment: None
    tracks-release-branches: false
    is-release-branch: true
  support:
    label : 'beta'
    increment: None
    is-release-branch: true
  feature:
    label: "feature"
    increment: Patch    
ignore:
  sha: []
  commits-before: 2026-02-01T00:00:00

RepositoryFixture Test

No response

Output log or link to your CI build (if appropriate).

git-graph-hotfix.log
gitversion-out.log
gv-cfg.yml

INFO [26-04-02 14:23:00:62] Please run `git log --graph --format="%h %cr %d" --decorate --date=relative --all --remotes=*` to see the git graph. This can help you troubleshoot any issues.

INFO [26-04-02 14:23:00:62] Working directory: d:\Documents\Projects\pp2
INFO [26-04-02 14:23:00:64] Project root is: d:\Documents\Projects\pp2\
INFO [26-04-02 14:23:00:64] DotGit directory is: d:\Documents\Projects\pp2\.git
INFO [26-04-02 14:23:00:64] Branch from build environment: 
DEBUG [26-04-02 14:23:00:64] Trying to find configuration file GitVersion.yml at 'd:\Documents\Projects\pp2'
INFO [26-04-02 14:23:00:64] Found configuration file at 'd:\Documents\Projects\pp2\GitVersion.yml'
INFO [26-04-02 14:23:00:64] Using configuration file 'd:\Documents\Projects\pp2\GitVersion.yml'
INFO [26-04-02 14:23:00:75] Using latest commit on specified branch
INFO [26-04-02 14:23:01:18] Getting tagged semantic versions. TagPrefix: ([Vv]|[Rr]elease-|[Hh]otfix-) and Format: Loose
INFO [26-04-02 14:23:01:59] Running against branch: hotfix/Hotfix-2026.04.01 ('f4b56e2' - Merge remote-tracking branch 'origin/master' into hotfix/Hotfix-2026.04.01)
INFO [26-04-02 14:23:01:60] -< Begin: Fetching the base versions for version calculation... >-
  INFO [26-04-02 14:23:01:60] -< Begin: Calculating base versions for 'hotfix/Hotfix-2026.04.01' >-
    INFO [26-04-02 14:23:01:60] -< Begin: [Using 'ConfiguredNextVersionVersionStrategy' strategy] >-
    INFO [26-04-02 14:23:01:60] -< End: [Using 'ConfiguredNextVersionVersionStrategy' strategy] (Took: 0.69ms) >-
    INFO [26-04-02 14:23:01:60] -< Begin: [Using 'MainlineVersionStrategy' strategy] >-
    INFO [26-04-02 14:23:01:60] -< End: [Using 'MainlineVersionStrategy' strategy] (Took: 0.50ms) >-
    INFO [26-04-02 14:23:01:60] -< Begin: [Using 'MergeMessageVersionStrategy' strategy] >-
    INFO [26-04-02 14:23:01:64] -< End: [Using 'MergeMessageVersionStrategy' strategy] (Took: 40.46ms) >-
    INFO [26-04-02 14:23:01:64] -< Begin: [Using 'TaggedCommitVersionStrategy' strategy] >-
      INFO [26-04-02 14:23:01:65] -< Begin: Getting tagged semantic versions on branch 'refs/heads/hotfix/Hotfix-2026.04.01'. TagPrefix: ([Vv]|[Rr]elease-|[Hh]otfix-) and Format: Loose >-
        DEBUG [26-04-02 14:23:01:65] Returning cached tagged semantic versions. TagPrefix: ([Vv]|[Rr]elease-|[Hh]otfix-) and Format: Loose
      INFO [26-04-02 14:23:01:66] -< End: Getting tagged semantic versions on branch 'refs/heads/hotfix/Hotfix-2026.04.01'. TagPrefix: ([Vv]|[Rr]elease-|[Hh]otfix-) and Format: Loose (Took: 9.09ms) >-
      DEBUG [26-04-02 14:23:01:67] Returning cached tagged semantic versions. TagPrefix: ([Vv]|[Rr]elease-|[Hh]otfix-) and Format: Loose
      INFO [26-04-02 14:23:01:67] Git tag 'Hotfix-2026.03.30': Version increment '2026.3.30' +semver 'None' with label 'beta' based on commit '36dc033'.
      DEBUG [26-04-02 14:23:01:68] Returning cached tagged semantic versions. TagPrefix: ([Vv]|[Rr]elease-|[Hh]otfix-) and Format: Loose
      INFO [26-04-02 14:23:01:68] Git tag 'Hotfix-2026.03.26': Version increment '2026.3.26' +semver 'None' with label 'beta' based on commit 'ed8ec44'.
      DEBUG [26-04-02 14:23:01:68] Returning cached tagged semantic versions. TagPrefix: ([Vv]|[Rr]elease-|[Hh]otfix-) and Format: Loose
      INFO [26-04-02 14:23:01:68] Git tag 'Hotfix-2026.03.12': Version increment '2026.3.12' +semver 'None' with label 'beta' based on commit 'da7b2cf'.
      DEBUG [26-04-02 14:23:01:68] Returning cached tagged semantic versions. TagPrefix: ([Vv]|[Rr]elease-|[Hh]otfix-) and Format: Loose
      INFO [26-04-02 14:23:01:68] Git tag 'Release-2026.03.05': Version increment '2026.3.5' +semver 'None' with label 'beta' based on commit 'c18f1be'.
      DEBUG [26-04-02 14:23:01:69] Returning cached tagged semantic versions. TagPrefix: ([Vv]|[Rr]elease-|[Hh]otfix-) and Format: Loose
      INFO [26-04-02 14:23:01:69] Git tag 'Hotfix-2026.02.19': Version increment '2026.2.19' +semver 'None' with label 'beta' based on commit 'abb58d1'.
      DEBUG [26-04-02 14:23:01:69] Returning cached tagged semantic versions. TagPrefix: ([Vv]|[Rr]elease-|[Hh]otfix-) and Format: Loose
      INFO [26-04-02 14:23:01:69] Git tag 'Hotfix-2026.02.12': Version increment '2026.2.12' +semver 'None' with label 'beta' based on commit '147a224'.
      DEBUG [26-04-02 14:23:01:70] Returning cached tagged semantic versions. TagPrefix: ([Vv]|[Rr]elease-|[Hh]otfix-) and Format: Loose
      INFO [26-04-02 14:23:01:70] Git tag 'Release-2026.02.05': Version increment '2026.2.5' +semver 'None' with label 'beta' based on commit '34eab66'.
    INFO [26-04-02 14:23:01:70] -< End: [Using 'TaggedCommitVersionStrategy' strategy] (Took: 56.35ms) >-
    INFO [26-04-02 14:23:01:70] -< Begin: [Using 'TrackReleaseBranchesVersionStrategy' strategy] >-
    INFO [26-04-02 14:23:01:70] -< End: [Using 'TrackReleaseBranchesVersionStrategy' strategy] (Took: 0.77ms) >-
    INFO [26-04-02 14:23:01:70] -< Begin: [Using 'VersionInBranchNameVersionStrategy' strategy] >-
    INFO [26-04-02 14:23:01:70] -< End: [Using 'VersionInBranchNameVersionStrategy' strategy] (Took: 0.63ms) >-
  INFO [26-04-02 14:23:01:70] -< End: Calculating base versions for 'hotfix/Hotfix-2026.04.01' (Took: 100.44ms) >-
INFO [26-04-02 14:23:01:70] -< End: Fetching the base versions for version calculation... (Took: 102.84ms) >-
INFO [26-04-02 14:23:01:70] -------------------------------------------------------
INFO [26-04-02 14:23:01:70] Base version used: Git tag 'Hotfix-2026.03.30': Take '2026.3.30' based on commit '36dc033'.
INFO [26-04-02 14:23:01:70] -------------------------------------------------------
INFO [26-04-02 14:23:01:70] -< Begin: Using manual deployment workflow to calculate the incremented version. >-
  INFO [26-04-02 14:23:01:70] 9 commits found between '36dc033' - Finish Hotfix-2026.03.30 and 'f4b56e2' - Merge remote-tracking branch 'origin/master' into hotfix/Hotfix-2026.04.01
INFO [26-04-02 14:23:01:71] -< End: Using manual deployment workflow to calculate the incremented version. (Took: 1.56ms) >-
DEBUG [26-04-02 14:23:01:71] Returning cached tagged semantic versions on branch 'refs/heads/hotfix/Hotfix-2026.04.01'. TagPrefix: ([Vv]|[Rr]elease-|[Hh]otfix-) and Format: Loose
DEBUG [26-04-02 14:23:01:71] Trying to find configuration file GitVersion.yml at 'd:\Documents\Projects\pp2'
INFO [26-04-02 14:23:01:71] Found configuration file at 'd:\Documents\Projects\pp2\GitVersion.yml'
INFO [26-04-02 14:23:01:71] Using configuration file 'd:\Documents\Projects\pp2\GitVersion.yml'
2026.3.30-beta.1+9

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions