Turn off the water supply, cut out the section of pipe containing the fitting to be replaced, and install a new section of pipe with new fittings is how to replace plumbing fittings. There are three types of plumbing fittings: compression fittings for copper lines, plastic fittings for PVC pipes, and soldered fittings which are an old style of connection for copper lines that is rarely used in newer construction. Specific procedures for installation vary depending on the fitting type.
For copper plumbing lines, it is best to use new compression fittings. Cutting out the old compression or soldered fittings and deburring the cut edges with emery cloth gives a clean, undamaged surface, producing a better seal and a reduced chance of leaks from the new fitting. If an old compression fitting is leaking, it is possible to unscrew the two halves of the fitting and replace the ferrule seal on the inside of the fitting and recompress it. Soldered fittings can't be removed and must be cut out.
Place the male compression nut on one end of the pipe to be connected, and position the female receiving collar on the end of the other piece. Put the ferrule ring inside of the female collar, and screw the male and female couplings firmly together to install the fitting. Repeat the process for the other connection point.
PVC fitting are glued together and must be cut out as well. After cutting the pipe, coat adhesive liberally around the inside walls of the fitting and slide it on the pipe. Allow the adhesive to dry to the manufacturer's specifications before turning on the water.