Prevent your main branch from dangerous changes

Description:
Enable a main branch protection by allowing pushing to main branch only to project leader. Also disable the possibility by rewriting the history.

Links:
https://docs.gitlab.com/ee/user/project/protected_branches.html
https://spectralops.io/blog/how-to-set-up-git-branch-protection-rules/
https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/managing-a-branch-protection-rule
https://cityofaustin.github.io/ctm-dev-workflow/protected-branches.html

Keywords:
version control, git, branch protection

Motivation:
Main branch protection should prevent losing code or breaking the project building.

Requirements/Prerequisities:
git

Level:
concret: specific best practice (e.g. use microservice)

Application domain:
Software engineering

Main phase:
Development: Implementation/Code/Build

Related literature:
Benvegnù, D. (2020, November 10). Best Practices for Branch Protection. DEV Community 👩‍💻👨‍💻. https://dev.to/n3wt0n/best-practices-for-branch-protection-2pe3

In which projects do/did you use this practice?
https://onemocneni-aktualne.mzcr.cz/

Full-stack Developer

3–5 years of experiences
Masaryk University

1. How do ​you rate the potential benefit for your projects? 5
2. How often are you using that practice? 5
3. What is the effort to introduce the practice in your project upfront? 1
4. What is the effort to apply the best practice in your project daily basis? 1

Questions 1, 3 and 4 (1 = Low, 5 = High)
Question 2 (1 = Never, 5 = Always)

You are running an old browser version. We recommend updating your browser to its latest version.

More info