A diode, resistor, or "idiot light" stops or limits current flowing OUT of the alternator's excite terminal.
This stops the alternator from powering the ignition system when the ignition switch is turned "off", preventing the engine from running on using alternator power, and also protects the alternator form possible internal damage.
A diode stops reverse flow altogether, but lets current flow in the opposite direction to provide "excite" current for the alternator at startup.
A resistor or "idiot light" flows enough current to "excite" the alternator, but limits current to a low enough value there's not enough to fire the ignition system, causing the engine to "run on" or damage the alternator under certain conditions.
You didn't say what alternator you have, the following diagrams are Delco, but other internally-regulated alternators would be similar.