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  #强制更新远程分支


#慎用!!

 

相关文章:

  • 2021-06-28
  • 2021-11-02
  • 2022-01-03
  • 2021-11-18
  • 2021-10-22
  • 2022-02-16
猜你喜欢
  • 2021-05-23
  • 2021-11-28
  • 2022-03-02
  • 2022-12-23
  • 2021-08-21
相关资源
相似解决方案