Yusuke Masuda
Yusuke Masuda

Reputation: 525

How I can bump the version to 1.0.0 by GitVersion

I operate git-version with git-flow. I want to bump version up to 1.0.0 when I merge develop to main.

Version as of develop is 0.1.0, and I did merge it to main with commit message contains bumping keyword. However it hit the constraint below, and the version didn't increment.

https://gitversion.net/docs/reference/version-increments

One thing to be aware of: If the current version is an alpha-version (i.e. 0.x.y.), attempting to bump the major version will merely bump the minor (eg from 0.2.0 to 0.3.0 instead of 1.0.0). Once the current version is greater than 1.0.0, bumping the major version works as expected.

I think this is very ordinary case, but we have the constraint in some reason. Why do we have it? How can I bump my version to 1.0.0?

Upvotes: 1

Views: 3617

Answers (1)

zionyx
zionyx

Reputation: 2085

You need to git tag the commit on main, with v1.0.0. This will produce 1.0.0 semver, and also kickstart gitversion's semver calculation like how the documentation shows.

But wait, what? Why? 👇

0.1.0 is the default starting semver gitversion produces on a repository without ANY git tags with accompanying semver, like v1.2.3 and v0.3.2.

Without any git tags, even with commit log message bumps, gitversion will never produce any semver higher than 0.2.0.

The reason is gitversion expects you to use git tags to help initiate subsequent semver calculations.

But even if your repository has git tags like v0.2.0 or even v0.99.999, gitversion will still not produce any semver that breaks the major version barrier from 0 to 1, regardless of commit log message bumps.

The point is, when you have created the v1.0.0 git tag to that commit on main, then gitversion will function as the documentation describes.

Upvotes: 1

Related Questions