semantic-versioninggitversion

Handling hotfix in gitversion


I'm trying to understand how GitVersion works. Here there is a snippet for 'gitversion /showconfig'

branches:
  develop:
    mode: ContinuousDeployment
  main:
    mode: ContinuousDelivery
  hotfix:
    mode: ContinuousDelivery
...

After shipping the release/1.1, my git is in this state:

Now I tried to to simulate an hotfix in production for the release 1.1.0

> git checkout master                                                    
> gitversion /showvariable FullSemVer                                  
1.1.0
> git checkout -b fix/1.1
> gitversion /showvariable FullSemVer                                        
1.1.0
> Add-Content -Name EmptyFile7.txt -Value 'Correction'
> git add --all;  git commit -m "fix(gitversion): modified EmptyFile7.txt"
> gitversion /showvariable FullSemVer
1.2.0-fix-1-1.1+1

I expected 1.1.1-fix-.... and now I don't know how to tag this fix.
For example, is this right?

> git checkout master
> git merge hotfix/1.1
> git tag 1.1.1

Should I handle all this not as a bugfix but in develop/release way?

Riccardo


Solution

  • The right branch was hotfix and not fix

    > git checkout master
    > gitversion /showvariable FullSemVer
    1.1.0
    > git checkout -b hotfix/1.1.1
    
    # Fix
    > Add-Content -Path EmptyFile7.txt -Value 'Correction'
    > git add --all;  git commit -m "fix(gitversion): modified EmptyFile7.txt"
    
    > gitversion /showvariable FullSemVer                                       
    1.1.1-beta.1+1 
    

    Now I can switch to master and approve the hotfix

    > git checkout master
    > git merge hotfix/1.1.1
    > git tag 1.1.1
    

    and finally merge back to develop

    > git checkout develop
    > git merge hotfix/1.1.1