Currently we use a dev-Branch in TFVC where every developer checks in. We have a Gated Checkin which ensures that our project builds.
Now we would like to switch to git, but TFS 2017 and Azure DevOps 2019 don´t have something similar to a Gated Checkin for git repositories. We could change our workflow to use feature branches and pull requests. But pull requests only test the code when merging to master (or another branch).
This would be okay if every feature is developed by a single developer. But in most of our features there work more than one developer on a feature. How could we prevent a developer from pushing code to a branch that breaks the build and blocks the other developers on the same branch?
How could we prevent a developer from pushing code to a branch that breaks the build and blocks the other developers on the same branch?
We could use the Branch policies to protect the protect the feature branch.
To prevent a developer from pushing code to a branch that breaks the build and blocks the other developers on the same branch, like Feature
branch.
We could add the Build validation on the Feature
branch to set a policy requiring changes in a pull request to build successfully with the protected branch before the pull request can be completed.
In this case, this Build validation will prevent a developer from pushing code to the feature
branch that breaks the build and blocks the other developers on the feature
branch.
When we have one more developers on this Feature
branch, each developer should create their own branch based on the Feature
branch, like Feature_DevelopA
, whenever a developer merges to Feature
branch, they need to pass the Build validation to complete the merge.
Besides, we could also add other Branch policies, like code reviewers.
Hope this helps.