If the generator with the higher voltage is on the anode, it will push current through the diode into the generator with lower voltage that is on the cathode if the difference in voltages is larger than the diode's forward voltage drop. If the generator with the higher voltage is on the cathode, then no current will flow unless the difference in voltage between the generators is so high that it blows through the diode's reverse blocking capability.
It's really no different from how it normally works. Nothing special. It's all about the voltage difference across the diode and which polarity it is.