It happens to all of us, we accidentally commit something into a git repo that we didn’t mean to, even worse we also pushed it to the main repository on GitLab or GitHub.
TL;DR — too long; didn’t read
Replace the current “master” branch with another “backup” branch.
git branch -f master backup
git push origin +backup:master