Role of diode in a circuit with coil

I understand that diode is place in the same circuit as coil (DC motor or relay) to prevent a voltage from hitting semiconductors, like transistors really hard.

Diode is always shown in parallel with coil, but what I think is strange, what is there to prevent voltage from going through node back into transistor. I know that diode lets the current only in the one direction, but at the node current can split into two wires.

The collapsing magnetic field when the coil is switched off induces a current in the opposite direction to the current which sustained it.
The diode is there to dissipate the current before it damages anything.
Google “Back EMF”.

effectively it is as if somebody pulled the plug in the bath. Magnetic field converts into the current and current tries to sink where it came from.

Well the diode feeds back the voltage from where it came from thus suppressing it.

Just one question here: is that sudden voltage spike dangerous for the oscilloscope. Oscilloscope is made for 5V, but spike goes much higher. I would like to record that spike, so I understand it better, but I am careful not to damage the scope.

Oscilloscope is made for 5V

We need to know what oscilloscope you are talking about. Better still we need to see the schematic to the input circuitry.

Its an old LeCroy digital oscilloscope.

Yes then it is likely to be correctly protected against excessive voltage input. You should have no worries.

just out of curiosity, how can you know, from such a small amount of info, that it will be ok?

Because LeCroy builds quality instruments, designed originally for nuclear researchers?

...because that manufacturer is a respectable manufacturer of oscilloscopes and they would, in fact, include over voltage protection circuitry. With the correct probe installed... you could measure 1000V signals.

And here's the cross-post. Please, please, PLEASE DROBNJAK...

DON'T DO THIS!

Do you have a model number for the scope, at least?

:P