This was our solution for replacing master on a corporate gitHub repository while maintaining history.
push -f
to master on corporate repositories is often disabled to maintain branch history. This solution worked for us.
git fetch desiredOrigin
git checkout -b master desiredOrigin/master // get origin master
git checkout currentBranch // move to target branch
git merge -s ours master // merge using ours over master
// vim will open for the commit message
git checkout master // move to master
git merge currentBranch // merge resolved changes into master
push your branch to desiredOrigin
and create a PR