Skip to content

Preserve branch protection status when importing from GitHub

Problem to solve

As described by @KOLANICH:

When a one imports a repo from GitHub, its master branch automatically gets protection, even if on GitHub it was not protected.

It causes some problems. For example if I like to rewrite history now I have to walk all therepos and unprotect their master branches.

Proposal

Branch protection status should be cloned from GitHub.

We decided to always use the strictest set of rules and ensure that the logic isn't about "default" vs. "non-default" (see discussion).

Calculated GitLab branch protection rule State of existing branch in GitHub Result
Unprotected Unprotected Unprotected
Protected Unprotected Protected
Unprotected Protected Protected
Protected Protected Protected with the strictest protection rules

References

Edited by Magdalena Frankiewicz