You should be able to use the “ours” merge strategy to overwrite master with develop branch like this:
git checkout develop
git merge -s ours master
git checkout master
git merge develop
The result should be your master is now essentially develop.
(-s ours
is short for --strategy=ours
)
From the docs about the ‘ours’ strategy:
This resolves any number of heads, but the resulting tree of the merge is always that of the current branch head, effectively ignoring all changes from all other branches. It is meant to be used to supersede old development history of side branches. Note that this is different from the -Xours option to the recursive merge strategy.
Update from comments: If you get fatal: refusing to merge unrelated histories
, then change the second line to this: git merge --allow-unrelated-histories -s ours master