On a top-post battery, replace a cable terminal if it is badly eaten by corrosion or if its jaws touch each other.
Disconnect both cables as explained. To install the commonest replacement, cut the cable wire close to the old terminal with a hacksaw.
Strip 1 inch of insulation from the wire. (If the wire is corroded, cut it back even farther but make sure the cable can still reach the battery; otherwise, replace the cable.)
Loosen the strap screws on the terminal, insert the bared wire end under the retainer, then retighten the screws.