Diesel engines operate at extreme high pressure. Also the fuel does the duty of a lubricant for the diesel engine and fuel injection system. Petrol is not an effective lubricant. It is more similar to a thinner. Hence petrol in diesel tanks leads to friction causing wearing down of the engine and fuel system. The resultant metal fragments may travel through the system causing damages to other parts too. Petrol being more volatile, high pressure of diesel engine leads to premature combustion on starting the engine. There is high probability of components getting damaged. The entire engine may cease work with a loud hammering sound.
To regain normalcy, the entire petrol has to be pumped out. Tank has to be thoroughly cleaned along with replacement of damaged components of the fuel system.
The filler necks of diesel tanks are bigger and will easily accept petrol nozzles. However, the chances of the tank of a petrol car getting filled with diesel are rare. Filler neck of petrol cars is smaller compared to diesel nozzles. This will prevent pumping diesel to the petrol tank.
Filling diesel in petrol tank is not as dangerous as in reverse case. Diesel being heavier and less evaporative compared to petrol, it needs pressure to be ignited. The injectors may feed the engine with diesel, but the spark plugs will not be able to ignite the diesel to start the engine.
Draining the tank, cleaning the injectors and filling the tank with petrol will solve the issue in majority cases.
If you note that your vehicle has been filled with wrong fuel, avoid turning on the ignition key. In modern vehicle engines, the fuel reaches the fuel system immediately on turning on the battery.