Before you disconnect the cable(s), first turn the ignition to the OFF position. This will prevent a draw on the battery which could cause arcing (electricity trying to ground itself to the body of a vehicle, just like a spark plug jumping the gap) and damaging components such as the alternator diodes.
When working on any electrical component in the vehicle, it is always a good idea to disconnect the negative battery cable. This will prevent potential damage to many sensitive electrical components such as the Engine Control Module (ECM), radio and alternator.
Disconnecting the negative battery cable first will also prevent accidentally grounding the positive terminal to the body of the vehicle when disconnecting the battery creating a short to ground.
Reconnect battery cables by installing the positive cable first. Then connect the negative cable. This will reduce the possibility for voltage spike to occur that can affect the operation of sensitive electronic components. Be sure to check that your lights, windshield wipers and other electrically operated safety components are working correctly. If your vehicle contains an electronically tuned radio don’t forget to also reset your radio stations and clock.