How to Replace Master Branch with Another Branch?

Suppose we have created a dev branch from the master branch and then the dev branch has got some new commit. So, now we want to use the dev branch’s codes only in master branch except all codes from the master. Let see how we can do that –
Make sure that your local master is up to date with the master remote:

And then we should use  “ours” merge strategy to overwrite master with dev branch. Like this –


 is short for 

Now, all the dev branch’s all codes should be in the master without its previous codes.

we can push/publish the master with 

Check the source code in your repository. 🙂