Use git checkout –orphan new_branch to create an independent branch new_branch based on the current branch;
git checkout --orphan mainAdd all file changes to the scratch space
git add -ASubmit and add submission record
git commit -am "init"Delete the branch you want to remove the commit record. This is master.
git branch -D masterRename the current independent branch to master
git branch -m masterForce push to remote branch
git push -f origin masterIf git push -f reports an error when pushing, it means that the permissions are insufficient. Or the main branch of Gitlab will be protected by default. You need to go to Project => Settings => Warehouse => Protected Branch to unprotect it.