The rebase would actually be:
git checkout develop
git rebase upstream/master
(git rebase should read: "rebase my current branch, here develop, on top of target branch, here upstream/master")
And the end result wouldn't be a detached head, but the newly rewritten develop branch.