Is there a way to disable "remove source branch" default option?
Asked Answered
B

3

22

We are working on Gitlab and each time I start merging a branch, Gitlab makes the option "Remove source branch" checked by default (which is -I think- dangerous).

enter image description here

As I don't guarantee that me or a colleague can forget to uncheck this option and make the mistake of removing the branch, I'm wondering if there is a solution to make it unchecked by default (which is -I think- will be more secure)?

Burgomaster answered 12/7, 2017 at 10:56 Comment(2)
Hi, any reason to not remove source branch? I'm googling but can't find answers.Donnie
I'd like to find a way to make this default to disabled for new/forked projects. Hmm.Roland
R
2

It only makes it checked by default if you check it during the creation of the merge request. If you uncheck it there, it should not be checked in the resulting merge request.

It was set to default to false in 9.3.5: Gitlab 9.3.5 Release notes

In the years that went by this was changed and in current releases of GitLab changing it afterwards is now possible. See @exud 's anwser.

Redwing answered 12/7, 2017 at 11:48 Comment(5)
thank @Redwing but I didn't checked anything during the creation of the merge request. The only options I have when creating a marge request are: Title, Description, Assignee, Milestone, Labels, Source branch, Target branch. No way to check or uncheck that option.Burgomaster
Are you maybe running an older version ? Which version of gitlab are you using ? in 9.3.5 and 9.3.6 I do get a checkbox just above the submit button.Redwing
I'm using GitLab Community Edition 9.2.2 found by checking gitlab.mydomain/helpBurgomaster
Please upgrade it (to 9.3.6). That will fix your problem.Redwing
Can this default be changed? More specifically, can the check on the merge request creation page be checked by default?Wendling
B
40
  1. Go to Settings > General > Merge requests
  2. Uncheck the box: Enable 'Delete source branch' option by default

This option is only available for the maintaniner role.

Bulk answered 10/6, 2020 at 15:17 Comment(1)
I just spend like half an hour searching for this option and I just realized that "developer" role doesn't have access to this option, but "maintainer" does.Hindsight
R
2

It only makes it checked by default if you check it during the creation of the merge request. If you uncheck it there, it should not be checked in the resulting merge request.

It was set to default to false in 9.3.5: Gitlab 9.3.5 Release notes

In the years that went by this was changed and in current releases of GitLab changing it afterwards is now possible. See @exud 's anwser.

Redwing answered 12/7, 2017 at 11:48 Comment(5)
thank @Redwing but I didn't checked anything during the creation of the merge request. The only options I have when creating a marge request are: Title, Description, Assignee, Milestone, Labels, Source branch, Target branch. No way to check or uncheck that option.Burgomaster
Are you maybe running an older version ? Which version of gitlab are you using ? in 9.3.5 and 9.3.6 I do get a checkbox just above the submit button.Redwing
I'm using GitLab Community Edition 9.2.2 found by checking gitlab.mydomain/helpBurgomaster
Please upgrade it (to 9.3.6). That will fix your problem.Redwing
Can this default be changed? More specifically, can the check on the merge request creation page be checked by default?Wendling
C
0

When create request, can uncheck the option. enter image description here

If checked mistakenly during the request creation, can uncheck when approve the merge request. If the approver is different, the approver has to do this.

enter image description here

If need to disable default check from the repository, can change the settings. New Git versions it's under Settings -> Merge Requests. Uncheck and save the settings.

enter image description here

Christyna answered 29/7 at 4:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.