Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can you stop a branch being deleted in a pull request?

Tags:

azure-devops

How can you stop a branch being accidentally deleted in a pull request?

The issue is the "Complete pull request" has got the "Delete dev after merging" check box, and this seems to be checked by default, which may be because I'm the owner of the repos.

Is there someway to disable this for all users?

like image 212
SteveC Avatar asked Feb 05 '18 12:02

SteveC


1 Answers

For now, there is no way to disable the Delete source branch after merging option.

And there is an user voice Disable Delete Branch Checkbox in PR When Branch Policy In Place which suggest similar feature, you can vote and follow up.

The workaround is set branch security for the target branch (dev branch for your situation):

In VSTS Branches Tab -> click button for dev branch -> Branch security -> change Force push (rewrite history, delete branches and tags) as Deny for the users and groups -> Save changes.

enter image description here enter image description here

BTW: Delete source branch after merging option in PR completing window is not checked/selected by default, but based on the last time's setting. Such as if you deselect the option now, when you open the PR completing window next time, the Delete source branch after merging option will be deselected.

like image 90
Marina Liu Avatar answered Oct 20 '22 13:10

Marina Liu