'GitVersion 5 generating wrong tags in build pipeline

I am using Azure DevOps as our build pipeline mechanism and using GitVersion v5.

We recently merged our main branch into our develop branch after our release. This generated a tag (develop-17.22.0-alpha.17). No issues.

However, after a PR has been merged into develop, the tag that gets generated is develop-17.22.0-alpha.12.

It is using the merge of our release branch into our main branch as it's base version. Is there a way to correct this?

My GitVersion.yml file for develop is as follow

 develop:
    regex: ^develop?
    mode: ContinuousDeployment
    tag: alpha
    increment: Minor
    prevent-increment-of-merged-branch-version: false
    track-merge-target: true
    tracks-release-branches: true
    is-release-branch: false


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source