I get them so badly almost every night to the point I almost scream and cry in pain, the minute you feel them, don't move your leg, just point your toes/foot up towards you, I find that makes them go away, or stepping on the floor helps too. Try massage the back of your calf when it's really sore too. I think we get them from not drinking enough water, hope this helps!
I get them to and my mom told me to step on the cold floor when I start getting them and once I step on the floor they go away it works for me so I do that so ui won't go threw the pain in the middle of the night
My doc just tells me to drink more water