Peaty's right (as usual)
Always take the negative off first, put the negative on last.
Always put a rag on the negative terminal when wrenching on the battery.
If *gawd forbid* a wrench or something metal should fall across the terminals, it will WELD itself there, and get so hot you can't touch it in like 2 seconds. Meanwhile, your battery is dumping like 6,000 or more amps across the short, and in just a few seconds the electrolyte (fluid in the battery) starts to boil...when electrolyte boils, it gives off Hydrogen and Oxygen, which as you probably know is TRUELY rocket fuel...By now the wrench looks like the element on an electric stove on "HIGH"...you get the idea.
Pulling a cable and stepping on the brake or pulling both and shorting them together will do the same thing, i.e. discharge the capacitors in the ECU.
Just my $.02