DEV Community

Cover image for How to replace master branch in git, entirely, from another branch?
Adam K Dean
Adam K Dean

Posted on

2 1

How to replace master branch in git, entirely, from another branch?

If you want to completely replace a branch by merging over another, the follow trick will help you, as it has helped me:

git checkout yourbranch  
git merge -s ours master  
git checkout master  
git merge yourbranch  
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Imagine monitoring actually built for developers

Billboard image

Join Vercel, CrowdStrike, and thousands of other teams that trust Checkly to streamline monitor creation and configuration with Monitoring as Code.

Start Monitoring