I would like to seek your guidance regarding this matter where we accidentally merge a non-master branch to the master branch via merge request. We wanted to do a refresh of the history of the master by delete the history of the non-master branch that was merged to the master to do that we plan on
- cloning the repository on our local.
- create a backup of the master branch.
git checkout master_backup
- checkout master and checkout the original commitId before the merge request has been accepted.
_git checkout -b <commit_id> _ old_master
- delete the master branch
git branch -D master
- replace master branch with the old_master branch
git branch -m master
- unprotect master branch using the Gitlab GUI.
- Force push the change back to the repository
git push -f origin master
- reprotect the master branch using the Gitlab GUI.
A. What do you think of the steps that we are taking? Are there anything the we have missed that you could point? Is the right thing to do regarding this matter?
P.S. Gitlab has a revert feature but it keeps the history of commit which is not what we exactly wanted.
Your thoughts are much appreciated.