Avoid magnesium oxide, which can be irritating to the digestive tract.Good dietary sources of magnesium include whole grains, leafy green vegetables (spinach especially), as well as almonds, cashews and other nuts, avocados, beans, soybeans and fish, especially halibut.