You must reinstall feature-branch to master, removing its dependencies on the commits A and B. If C and D have real semantic dependencies at the code level on A and B, then of course you are out of luck.
The following sequence of commands will change feature-branch to master instead of develop :
git checkout feature-branch git rebase --onto master develop
source share