You might want to protect your most important branches against directly pushing changes to them, or more importantly protect them against force pushing, which is pushing to your repository without taking changes by other people into account, using the
Protecting a branch can be done in GitLab by marking a branch as Protected. This means that people with the Developer permission level and lower are not able to push changes directly to that branch; they need to create a merge request to push changes to these branches. Also, this prevents anyone from force pushing to that branch.
In the following steps, we will protect a branch: