git删除/撤销远已经push到程服务器上某次代码提交

场景:不当心把一次错误的代码push到远程服务器上的分支上,须要当即删除/撤销此次代码提交。
具体方法,git命令:
git reset --hard <commit_id>
git push origin HEAD --forcehtml

commit_id能够经过git命令:
git log
输出获取。
commit_id形如:126f206185f225879f2723ca421f4dee44ca8fe7git

而后完整命令:服务器

git reset --hard 126f206185f225879f2723ca421f4dee44ca8fe7
git push origin HEAD:develop  --forceyii

 

参考地址:http://m.yiibai.com/git/git_push.htmlhtm

相关文章
相关标签/搜索