Reset on master branch
Sometimes in working on your projects you need to undone some unwanted commits made to master branch. I will show how to do it with GitLab repo.
If you follow regular workflow with git reset to reset to some commit
git reset --hard <commit_hash>
git clean -f -d
and then force push to master to reflect changes on remote repo
git push -f origin main
you can get error
remote: GitLab: You are not allowed to force push code to a protected branch on this project.To gitlab.cleverbots.ru:cleverbots/hills_customer_care.git! [remote rejected] main -> main (pre-receive hook declined)error: failed to push some refs to 'gitlab.cleverbots.ru:cleverbots/hills_customer_care.git'
You need to obtain rights to force push to protected branch.
If you are maintainer go to Settings > Repository. Expand Protected branches, find master branch in list and move switch for option Allowed to force push