git 远程仓库回滚

git  branch backup  #创建备份分支
git push origin backup:backup #push到远程
git reset --hard commit_id #本地分支回滚
git push origin  :the_branch #删除远程分支
git push origin the_branch #重新创建远程分支


#如果远程分支为master分支,会提示不能删除
#有两种方法解决这个问题
#第一种:
#在远程仓库的目录下,设置git的receive.denyDeleteCurrent参数
git receive.denyDeleteCurrent warn  
#第二种
git reset --hard commit_id #本地分支回滚
git push origin the_branch -f  #强制更新远程分支


#慎用!!
原文地址:https://www.cnblogs.com/iwangzc/p/4062568.html