Gitflow is great, it supports you and your team members in following a proper flow for branches and commits.
See A successful Git branching and a successful Git branching model.
Also happy Jakob Ehn made a Gitflow Visual Studio extension for VS2015, which is very useful.
Visual Studio Branch policies are great too, it helps you and your team members to control the quality of a branch.
VSO branch policies are release in May, see: Build preview, updated backlog navigation, branch policies, and more... – May 15
‘Enabling branch policies will require changes to be submitted using pull requests.’
Using them together is great, but …
GitFlow mainly executes on the local repository and the VSO branch policies work on the Remote branches. Tuning your flow a bit will make them work together.
After you have defined your branch policies and configured the Visual Studio GitFlow addin. Start a new Feature and do you coding magic.
When done and you want to finish the feature. Clicking on the Gitflow ‘finish feature’ will merge / rebase the feature branch to the develop branch, local.
now the local develop branch has the change.
the problem now is, when you want to push your changes to develop the branch policy jumps in.
to work around this there are several possibilities.
You can make an additional develop / integration branch mark that one in the GitFlow configuration as development branch, use the finish Feature and push changes from that branch to remote, and finally make a Pull Request from that branch to the branch with the policies configured.
The additional needed branch can be a reason to use another solution, also the Pull requests all come from one Branch which can be challenging when abandon a Pull Request.
The other way is not use the ‘Finish Feature’ Gitflow activity. but. After finishing the feature, fetch the develop branch (contains the latest pull requests), merge develop in to the feature branch and Push it. In Visual Studio Online create a Pull Request to develop.
and the branch policies jump in for develop. keeping track of the quality of the branch which is going to be merged.
[this is the VSO policy traffic light ]
When all policies are fulfilled complete the Pull Request and delete the remote feature branch.
A small workaround with a clean result.
All thoughts are welcome to tune it.