Unfortunately Git doesn't make it easy in this situation. First do an interactive rebase on the D branch by deleting commit X.
You'll have the following history:
A--X--B
\ \
\ E--F
\
B'-C'-D'
Then you'll need to rebase the F branch onto B' with:
git rebase --onto B' B F
(replace commits names by their ids)
That will end up with
A--B'-C'-D'
\
E'--F'