Detonation is when the auto-ignition point of the air/fuel mixture is reached prior to the flame front reaching it causing a sudden spike in cylinder pressure. Pre-ignition is essentially the same thing except the fuel is ignited and burning (rather than sudden combustion) prior to the spark or flame front.
Octane is a measure of the auto-ignition point of the end gases (and nothing else) thus directly related to both pre-ignition and detonation. However, it's not the only fuel parameter than affects pre-ignition and detonation. How well the fuel readily vaporizes and how much heat it pulls out of the intake air in the process are as much a factor. It's how E85 at ~100 octane, with +400% higher HoV, has similar detonation and pre-ignition resistance as 116+ octane race fuel. Similarly, 93 octane gasoline with 10% ethanol is more detonation / pre-ignition resistant than 93 octane non-ethanol fuel.
This is the problem with GDI. With the fuel injected directly into the cylinder just prior to ignition, there's no time to properly vaporize and cool the mixture thus much of the knock resistance from the fuel's HoV is nullified.