Gym goers - how do you prevent or recover from pinched nerves?

Usually doesn’t happen to me, but recently, I pinched a nerve in my wrist last week while doing my arm workouts and it made my thumb go numb for 5 days, and last night while doing core workouts, I pinched a nerve in my back that gave me a lot of pain in my ribs.. the nerve isn’t pinched anymore but the whole left side of my back feels like it was hit by a car.. obviously I’m not pinching nerves on purpose, it sucks! I always stretch and warm up before exercising, so what’s causing this recently?
Gym goers - how do you prevent or recover from pinched nerves?
Post Opinion