具体方法,git命令:
git reset --hard <commit_id>
git push origin HEAD --force
commit_id可以通过git命令:
git log
输出获取。
commit_id形如:126f206185f225879f2723ca421f4dee44ca8fe7
然后完整命令:
git reset --hard 126f206185f225879f2723ca421f4dee44ca8fe7
git push origin HEAD --force
Note:此方法会回退到commitId为126f206185f2258的版本(commitId在126f206185的提交代码都会被回滚掉,要慎重)
默认是protected的branch是不能force push的会报错
原文:https://www.cnblogs.com/daxiong225/p/13464320.html