This error basically occurs when you've shared your previous master branch with anyone, this will create problems, since if the history of the two branches diverged, you'll be publishing rewritten history.
Essentially what you want to do is to merge your branch into master but exactly keep the versions of the files in the topic branch. You could do this with the following steps:
# Switch to the topic branch:
git checkout branch
# Create a merge commit, which looks as if it's merging in from master, but is actually discarding everything from the master branch and keeping everything from branch:
git merge -s ours master
# Switch back to the master branch:
git checkout master
# Merge the topic branch into master - this should now be a fast-forward that leaves you with master exactly as branch was:
git merge branch
Note: if you think that merge, you were trying to do was a bad idea, then you can put things back to normal with:
git reset --merge