# Gitflow branches

**URL:** https://www.finalbuilder.com/forums/t/gitflow-branches/5498
**Category:** Discussion
**Created:** [August 3, 2016, 5:00am UTC](https://www.finalbuilder.com/forums/t/gitflow-branches/5498 "2016-08-03T05:00:57Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![remko.seelig](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/r/5f9b8f/32.png) [@remko.seelig](https://www.finalbuilder.com/forums/u/remko.seelig)
#### Post date: [August 3, 2016, 5:00am UTC](https://www.finalbuilder.com/forums/t/gitflow-branches/5498/1 "2016-08-03T05:00:57Z")

</div>

Hi,

One of our development teams is using Git and Gitflow with Continua. Gitflow branches are formatted ‘feature/feature1’, ‘feature/feature2’ and accessible through the property $Build.BranchName$.

However, our builds are stored on a networkshare and we’re using the branchname as subfolder. Since Gitflow branches contain a slash (’/’) character, this will actually lead into another subdirectory when using a gitflow branch name in a pathname.

e.g. Output path: \server\share\releases$Build.version$.$Build.BranchName$ will lead to different paths (and path depths) for master branch and feature branches:

\server\share\releases\1.0.0.master…  
\server\share\releases\1.0.1.master…  
\server\share\releases\1.0.0.feature\feature1…

Looking for advice/smart solution in this matter. We can always get rid of Gitflow or change the feature structure, but probably would be better to solve this another way. We haven’t found any “Continua way” solution yet. Within variables or properties you cannot regex or replace strings/characters (as far as I am concerned). “set variable” allows replacement of variables, but this is merely a rewrite. Even though you can append, you cannot replace.

Kind regards,  
Remko Seelig

---

<div class="post-metadata">

### Author: ![Sparky](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/sparky/32/10_2.png) [@Sparky](https://www.finalbuilder.com/forums/u/Sparky)
#### Post date: [August 4, 2016, 7:20am UTC](https://www.finalbuilder.com/forums/t/gitflow-branches/5498/2 "2016-08-04T07:20:17Z")

</div>

Hi Remko,  
  
We may add string manipulation functions in the future. For now, you will need to do this using FinalBuilder project, batch file, Powershell script or another external program. A FinalBuilder project with String Replace and Continua CI - Set Variable actions would be the simpliest to manage.   
  
Alternatively you can use the following example PowerShell script:

`param(`

`    ``[Parameter(Mandatory = $true)] [string]$variableName,`

`    ``[string]$text = “”`

`) `

`[string]$result = $text.Replace("/","_")`

`write-host "@@continua[setVariable name=’$variableName’ value=’$result’]"`

  
and pass this the arguments  
  
&nbsp;“branchFolder” “$Source.RepoName.BranchName$”&nbsp;  
  
where branchFolder is the name of a variable defined in Continua CI

---

<div class="post-metadata">

### Author: ![remko.seelig](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/r/5f9b8f/32.png) [@remko.seelig](https://www.finalbuilder.com/forums/u/remko.seelig)
#### Post date: [August 4, 2016, 9:46am UTC](https://www.finalbuilder.com/forums/t/gitflow-branches/5498/3 "2016-08-04T09:46:09Z")

</div>

This was exactly what I was looking for. Works like a charm. Thank you very much!

---

<div class="post-metadata">

### Author: ![catenalogic](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/catenalogic/32/116_2.png) [@catenalogic](https://www.finalbuilder.com/forums/u/catenalogic)
#### Post date: [August 4, 2016, 10:46am UTC](https://www.finalbuilder.com/forums/t/gitflow-branches/5498/4 "2016-08-04T10:46:58Z")

</div>

@Remko: we use GitFlow everywhere as well. A few (possibly) interesting projects for you:   
  
 \* GitVersion =\> automatically determine the version (based on GitFlow) for your software   
 \* ContinuaInit (see [http://geertvanhorrik.com/2014/06/17/introducing-continuainit-initialize-build-server-variables/](http://geertvanhorrik.com/2014/06/17/introducing-continuainit-initialize-build-server-variables/))   
  
 This way you can have an initialization stage where everything is prepared for the builds. If you define these variables, they will be filled for you automatically:   
  
 GitVersion\_FullSemVer   
 GitVersion\_MajorMinorPatch   
 GitVersion\_NuGetVersion   
 IsOfficialBuild   
 PublishType   
  
 Then you can use this versioning to stamp your assembly info, nuget packages, etc.
