An inlet box is mounted on the outside of the house, usually near where you'll set the generator. A single heavy-duty cord runs from the generator to that inlet, and a manual transfer switch at the panel lets you choose which circuits receive generator power.
Because the switch disconnects those circuits from the grid before generator power reaches them, nothing feeds back into the utility lines. Line workers stay safe, and so does your equipment when power comes back.