How to replace master branch in git from another branch

If you happen to come into the situation that your master branch is screwed (e.g. by falsely merging and reverting other/old branches into the master) you might need to replace your master with another branch (like your develop branch). That is actually pretty easy, all you need to do is executing the following git commands:

git checkout develop
git merge -s ours master
git checkout master
git merge develop


After you executed the commands your master branch is completely up-to-date with your develop branch.

Source: stackoverflow

April 7th, 2018