Git overwrite master with <my_branch_name>

It may be useful to replace all the code on master with another branch you've been working on. Depending on what you want to keep on master there are a couple of ways of doing this.

In these examples we will replace master with the content on develop

Maintain master history

You want to keep your previous progress on master, just move all code from develop across and wipe over the files on master.

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

Replace master completely

It's all gone wrong and you just want to wipe over master.

git checkout develop
git push -f origin master