Longbox is correct on this. In all automotive electrical work the ground is connected last. In days of old it was done so that you could not fry your wrench and today it is done so that you cannot fry the electronics and your wrench.

The loads produced by grounding a battery are not the same as with line voltage for commercial or residential. I have never heard of anyone being elecrocuted by grounding a battery, but it is possible to be burned very bad. The battery can explode as well, but this would take more than just a momentary grounding with a wrench.