This is done inside the alternator via a voltage rectifier, consisting of diodes (one-way check valves ... at the front of the engine. Some are easy to spot while others can be tucked lower ...