How can diet and exercise help prevent migraines?

How can diet and exercise help prevent migraines?