Skip to content

Increment 'Minor' number when merging feature branch in master in Mainline mode #1221

@mabead

Description

@mabead

I have a GitVersion.yml that contains the following

mode: Mainline
branches:
  feature:
    mode: ContinuousDeployment
    increment: Minor

So my intent is:

  • feature branch should always increment 'minor' number.
  • when feature branch is merged in master, it should bump the minor version of the master branch.

Note that if I don't set the mode to ContinousDeployment for my feature branches, then GitVersion does not increment the Minor version. It always increment the patch number. I don't understand why but that's not the point...

Then, look at the following operations:

PS C:\git\GitVersion.MainlineMode> git tag v1.3.0
PS C:\git\GitVersion.MainlineMode> (.\GitVersion\GitVersion.exe | Out-String -Stream | convertfrom-json).FullSemVer
1.3.0
PS C:\git\GitVersion.MainlineMode> git checkout -b features/some-feature
Switched to a new branch 'features/some-feature'
PS C:\git\GitVersion.MainlineMode> (.\GitVersion\GitVersion.exe | Out-String -Stream | convertfrom-json).FullSemVer
1.3.0
PS C:\git\GitVersion.MainlineMode> git commit --allow-empty -m 'commit 1'
[features/some-feature 01c04fa] commit 1
PS C:\git\GitVersion.MainlineMode> git commit --allow-empty -m 'commit 2'
[features/some-feature 003158c] commit 2
PS C:\git\GitVersion.MainlineMode> (.\GitVersion\GitVersion.exe | Out-String -Stream | convertfrom-json).FullSemVer
1.4.0-some-feature.2
PS C:\git\GitVersion.MainlineMode> git checkout master
Switched to branch 'master'
Your branch is based on 'origin/master', but the upstream is gone.
  (use "git branch --unset-upstream" to fixup)
PS C:\git\GitVersion.MainlineMode> (.\GitVersion\GitVersion.exe | Out-String -Stream | convertfrom-json).FullSemVer
1.3.0
PS C:\git\GitVersion.MainlineMode> git merge --no-ff features/some-feature
Already up-to-date!
Merge made by the 'recursive' strategy.
PS C:\git\GitVersion.MainlineMode> (.\GitVersion\GitVersion.exe | Out-String -Stream | convertfrom-json).FullSemVer
1.3.1

To summarize:

  • I start from a repo that has the v1.3.0 tag
  • I create a feature branch where I do two commits
  • This branch tells me that it wants to be numbered 1.4.0 since GitVersion says that the full semver is 1.4.0-some-feature.2.
  • Then, I merge this branch in master. At the point, GitVersion tells me that the version of the master branch is 1.3.1.

What am I doing wrong? What do I have to do for master to jump to 1.4.0 as requested by the feature branch that just got merged?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions