git reset origin --hard解决‘Your branch is ahead of 'origin/xxxx' by xx commit.’
如图:
之前是这么解决的解决git:Your branch is ahead of ‘XXX‘ by X commits-CSDN博客git删除/撤销远已经push到程服务器上某次代码提交场景:不小心把一次错误的代码push到远程服务器上的分支上,需要立即删除/撤销这次代码提交。具体方法,git命令:git reset --hard git push origin HEAD --forcecommit_id可以通过git命令:git log输出获取。git删除/撤销远已经push到程服务器上某次代码提交_git删除某次push_zhangphil的博客-CSDN博客。明明2个commits已经提交,到代码仓库看,也确实已经提交成功。https://blog.csdn.net/zhangphil/article/details/129623148
更简单的git命令:
git reset origin --hard