The documentation (git help rebase) suggests that “git rebase –force-rebase” does just this — but (Git 1.9.1) it doesn’t. The documentation also suggests that “git rebase -i –no-ff” is equivalent to that command — but it isn’t: it does work.
Having cloned your gist, the commands:
git checkout topic
git rebase -i --no-ff --onto master 7b3af topic
produce the desired result, with new versions of the “third” and “fourth” commits on top of master, and topic pointing at the new version of “fourth”. In the second command, the SHA 7b3af is the “second” commit, the point where topic was branched from.