[本文出自天外归云的博客园]

如果不小心把代码push到master了怎么办?

代码不小心push到master该怎么办?

 

解决方案

这么做:

1. git reset --hard 刚刚的commitID
2. 暂时关闭分支保护机制
3. git push origin master --force-with-lease
4. 重新开启分支保护机制

注意

以后再提交代码前git status或git branch特意关注下当前分支,不要再搞错分支了

 

相关文章:

  • 2022-12-23
  • 2021-07-08
  • 2021-11-10
  • 2022-12-23
  • 2021-04-05
  • 2021-04-20
猜你喜欢
  • 2022-12-23
  • 2021-07-16
  • 2021-08-07
  • 2021-11-04
  • 2021-08-20
  • 2021-10-12
相关资源
相似解决方案