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

时间:2018-02-05 12:59:08

标签: 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?

2 个答案:

答案 0 :(得分:6)

目前,在合并选项后无法禁用删除源分支。

并且有一个用户语音Disable Delete Branch Checkbox in PR When Branch Policy In Place,其中包含类似功能,您可以投票和跟进。

解决方法是为您的情况设置目标分支(dev分支)的分支安全性:

在VSTS分支标签中 - >点击分支的dev按钮 - >分行安全 - >更改强制推送(重写历史记录,删除分支和标签)为用户和组拒绝 - >保存更改。

enter image description here enter image description here

BTW:默认情况下,未选中/选择PR完成窗口中的合并选项后删除源分支,但是基于上次设置。例如,如果您现在取消选择该选项,则下次打开PR完成窗口时,将取消选择合并后删除源分支选项。

答案 1 :(得分:0)

我在这个线程上可能有点晚了。我遇到了这个问题并在 Azure Dev Ops 中找到了解决方案。在批准时,您可以选择取消选择。

enter image description here