简体   繁体   中英

How can I force a git rebase and override merge conflicts

I have a local and remote dev branch which is good. My master branch, however, is having some issues. The dev branch is solid enough that I can rebase master from dev.

When I run git rebase dev from my checked out master branch, it shows 1k+ conflicts. Way too many to go through one by one.

How can I rebase or reset the master branch so it is completely replaced by my dev branch? I know this isn't the right command but is there something like a git rebase dev --force or git reset --hard origin/dev or something I can use?

You generally never rebase master on top of another branch (which was most likely created from master)

so it is completely replaced by my dev branch?

The git reset --hard origin/dev should be enough (assuming you are on master ), followed by a git push --force, provided you clearly communicate to any user of that repo they need to reset they own local master to the new history.

Make sure you don't have any pending modification.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM