According to Healthline, you can prevent charley horses by eating high-nutrient foods like papaya and avocado, which contain potassium and magnesium, and watermelon, which we all know is very hydrating. Foods like sweet potatoes, beet greens, Greek yogurt, and salmon are also great to include in your diet.