如何完全将开发分支替换为主分支?(无需解决冲突)

huangapple go评论60阅读模式
英文:

How to completely replace dev branch into master? (Without having to resolve conflicts)

问题

My master branch is very out of date. Like 100+ commits behind dev, it is no longer needed anymore. If I merge with dev, there are many conflicts I don't need to resolve. Plus, I have created a master-old branch just in case. How can I make dev as my master without having to resolve conflicts.

I tried:

  1. Destroy master and create it again from dev (not allowed by GitHub)
  2. Rebase (It needs to resolve conflicts)
  3. Flag --theirs (not sure how to use it)
英文:

My master branch is very out to date. Like 100+ commits behind dev, is not longer needed anymore. If I merge with dev there are many conflicts I don't need to resolve. Plus, I have created a master-old branch just in case. How can I make dev as my master without having to resolve conflicts.

I tried:

  1. Destoy master an create it again from dev (not allowed by github)
  2. Rebase (It need to resolve conflicts)
  3. Flag --theirs (not sure how to use it)

答案1

得分: -1

最简单的方法:

git checkout master
git reset --hard dev
git push --force
英文:

The easiest way:

git checkout master
git reset --hard dev
git push --force

huangapple
  • 本文由 发表于 2023年5月24日 17:43:58
  • 转载请务必保留本文链接:https://go.coder-hub.com/76322154.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定