The attacks from Gaza towards Israel are targeted at civilian infra.
The Israeli retaliations are targeted at the militants with the intention of killing the militants. The strikes are incredibly surgical and despite needing to happen in civilian areas usually only kill the targeted militants.
But not always.
Still much much better than any other military that's tried to do surgical strikes in civilian areas.