Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Versioning on development and release branches (git-flow)

On http://nvie.com/posts/a-successful-git-branching-model/ it says:

Release branches are created from the develop branch. For example, say version 1.1.5 is the current production release and we have a big release coming up. The state of develop is ready for the “next release” and we have decided that this will become version 1.2 (rather than 1.1.6 or 2.0). So we branch off and give the release branch a name reflecting the new version number:

$ git checkout -b release-1.2 develop
Switched to a new branch "release-1.2"
$ ./bump-version.sh 1.2
Files modified successfully, version bumped to 1.2.
$ git commit -a -m "Bumped version number to 1.2"
[release-1.2 74d9424] Bumped version number to 1.2
1 files changed, 1 insertions(+), 1 deletions(-)

Now I have a number of issues with that:

  • The develop branch is still at 1.1.5; when will this be updated? Does it make sense that the develop branch is "behind" a release branch in terms of version numbers at a certain moment in time?
  • So say I increase my version numbers before creating the release branch. If I do so, I have the same version number on dev and release branch until the next release, which I think makes more sense. What are the reasons for bumping version numbers after creating the branch?

Even then, actually I want my development branch to have a version number that clearly indicates that this is a development version (because no one who finds a generated "myproject-1.2.jar" file somewhere should consider for a second to run this jar file in a production environment). So from the moment I create the release branch I would like the version numbers to reflect "this is version 1.2.0" and "this is a development version based on 1.2".

Unfortunately, when creating the release branch, bumping the version number to "1.2" there and to something like "1.2+dev" on the development branch will result in a conflict every time I will try to merge changes from the release branch back into develop. Do you have any advice how to get this kind of versioning in place using git?

like image 792
tgpfeiffer Avatar asked Nov 28 '14 09:11

tgpfeiffer


People also ask

Is Gitversion a release branch?

According to your gitversion. yml file, the only releasable branch is release branch. The semver you get from every commit from those release branches will have a beta tag added. Even if you name your release branch like releases/v1.2.3 , you will get 1.2.

What is development branch and what is release branch?

The release branch represents a complete feature set. The only commits on the release branch are for bug fixes and important chores. The Gitflow release branch is created off the development branch. Gitflow release is merged into master and also back into development.

What is Git flow branching strategy?

The GitHub flow branching strategy is a relatively simple workflow that allows smaller teams, or web applications/products that don't require supporting multiple versions, to expedite their work. In GitHub flow, the main branch contains your production-ready code.


1 Answers

It seems like the following workflow is actually able to realize the desired versioning in git:

  • Version on the develop branch is <last-release>+dev.
  • When releasing a new version from the develop branch:
    • Change version numbers in files to <next-release> and commit.
    • Create the branch releases/v<next-release> from develop.
    • On develop, change version numbers in files to <next-release>+dev and commit.
    • When release is complete, merge the releases/v<next-release> branch into master and tag it.

This way,

  • it is easy to know which release version the current dev code is based on,
  • a jar file created on the develop-based branch is easily detectable as development version,
  • while the commits on the release branch can still be merged back to the develop branch.
like image 140
tgpfeiffer Avatar answered Oct 06 '22 07:10

tgpfeiffer