I have master
and hotfix_master
branches. These are release branches and are protected in Gitlab UI under project settings.
what I'm trying to achieve is, rebase the hotfix_master
branch after every production release which happens from master
so that if customer raises any bug, we can fix that bug on hotfix_master
branch and release to customer.
while doing a proof of concept, I realized is that even though hotfix_master
branch is protected, I can still rebase without creating any PR. Is that expected? if yes, what the use of protection? and what should be done to allow rebase only after creating PR?
EDIT 1
This is what I am doing
- git fetch
- git checkout hotfix_master
- git diff --name-only origin/hotfix_master...origin/master
- git rebase origin/master
- git status
- git push
after rebasing , what I see is , all the changes from master
are now on hotfix_master
. so, where is the question of PR ? why gitlab is not complaining that you haven't raised PR . Please suggest
EDIT 2
"Branch protection" is a feature of GitLab and GitHub. It protects branches in the shared repository from being force-pushed, potentially losing history.
When you have a local clone, you can do whatever you like to your local branches (create them, reset them, merge them, rebase them, create commits, etc.), but you can only perform fast-forward pushes on the "protected branches).