Turn the main water valve 90 degrees clockwise to shut off the water while you work.
Locate the damaged stub under the sink.
Mark the pipe just behind the damaged area.
Cut the pipe off using a hacksaw or pipe cutting tool.
If the stub is too short to access with a new valve or other fitting, place a push-to-fit compression coupler over the exposed end of the pipe. Push down on the coupler until it clicks into place.
Cut a small section of pipe that matches the diameter and type of the stub pipe. Cut the pipe as long as you need to extend the stub for access. About 6 inches is usually adequate for most applications.
Press the new section of pipe into the coupler until it clicks into place. The new stub is ready for a valve or other fitting.