I have a branch like git that has dev / master / production branches used for step deployments, so there are branches that I want to protect from being deleted. I use pull requests and Visual Studio Team Services, so after each transfer request from dev to master, for example, VSTS asks if I want to remove the source branch (dev).
I was worried that the developer accidentally deleted the dev or other important branch that is used for deployments, so I used this hack:
I created a developer branch called "save", made a one-line change, opened a pull request against dev and just left it open.
As long as there is an open pull request against dev, dev cannot be deleted, and VSTS will not ask if I want to delete the branch.
If there is any other official solution to this problem, I would be happy to use it. But at the moment it was easy and works.
source share