You want to prevent it in the first place. Rest is necessary to keep an injury from getting worse. This doesn't mean you have to totally stop. You can try continuing an activity if pain allows. If the pain persists stop the activity.
Ice can effectively decrease pain from an injury.
Icing deadens pain and increases blood circulation to the skin which is OK and decreases circulation to deeper areas where bleeding may be occurring. Apply ice as soon as possible. Ice for 20 minutes and then remove the ice. Place a thin layer of material between the ice and the bare skin. Repeat icing for 20 minutes every two hours.