1. View the log and copy the commit number A you want to restore to
Assuming A=30c8404a0c9a58452c23f509e7ee19eace06c50d
git log
2. Restore the code to version A
git reset --hard 30c8404a0c9a58452c23f509e7ee19eace06c50d
3. Force update to remote branch
git push -f origin master
4. If there is an error in 3,
go to gitlab to check whether the project master branch is protected
After going to the
Setting>Registry>Protected Branches
UnProtect master branch
Retry step 3
git push -f origin master
Remember to restore the protected branch
After going to the
Setting>Registry>Protected Branches
Protect master branch