Before the ketogenic diet became the latest low-carb diet trend, it was used to treat drug-resistant epilepsy in children. Doctors had observed that fasting and eating mainly fat and little else, mimicked the effect of starvation in the brain and reduced the amount of seizures.
This diet was originally developed for treating childhood epilepsy a century ago and is now being studied to treat migraines.
A recent study (2016) made similar positive observations with migraines. Cherubino Di Lorenzo studied the effect of a ketogenic diet on migraine patients and found that patients had fewer headaches. In most cases, the headaches even disappeared during the ketogenic phase of the diet. 
After the first study, they decided to confirm their findings in a large population of participants. They followed strict protocol of the Italian Society of Medical Dieting (SDM) that restricts the duration of the ketogenic diet to one month, followed by a five month long non-ketogenic phase of dieting. They found that the headaches dramatically improved only during the ketogenic phase of the diet, and worsened again at the end of the trial. Therefore, they concluded that the ketogenic diet was the reason for that improvement. 
They were unable to substantiate if ketones were solely responsible for pain reduction (and weight loss). In the majority of cases, a question arose around abnormal glucose tolerance test results. So their hypothesis was that the outstanding therapeutic effects obtained were due to both the ketones and the mitigation of blood sugar and insulin level responses (so sugar intake - carbohydrates) from reducing carbohydrate intake. 
So can a keto diet help with migraines?
It can if it does! As with everything migraine... there's no one size fits all. Here's what the researchers concluded:
They're studying effects on chronic migraines next.
I hope this goes without saying - to find a doctor or professional to work with if you decide to test out this ketogenic diet.
Get professional medical supervision. If the diet is done incorrectly, it could be unhealthy.
~ Bengsch, D. 
In order to help answer the question - can a keto diet help with migraines, and keep things a little easier to understand... here's a Q & A with Nurse Practitioner and migraine expert Angel Moreno at the 2019 Migraine World Summit.
Very briefly, the keto diet achieves ketone bodies by typically restricting carbohydrates so low that the body is forced to seek a different type of fuel. So, it gets the body to use fat as an energy source instead of carbs.
There’s a term called nutritional Ketosis is where the blood level Beta-hydroxybutyrate (or BHB) changes from .5 millimoles to 3.0 millimoles. In this state people generate ketone bodies and the body can run off ketone bodies. The brain needs glucose, we need to have fat, and we need to have protein (need the amino acids in the protein) there’s nothing in carbohydrates that’s essential. We need essential fatty acids and essential amino acids but they’re not in carbs.
We must remember that humans never had a market to go to, they had to hunt and scavenge for their food. This is where the Paleo diet comes in, you’d eat what you could hunt. There were no planting crops or harvesting. People were also more nomadic and moved around a lot. They had lots of small meals throughout the day. This is different to the keto diet where the healthy fat burns slower and provides longer term energy for the body.
It’s way easier to burn carbohydrate than fat. The body has no need to oxidize fat, so it stores it.
You could think of this process as the body’s own biochemical liposuction. Each molecule of ketone bodies produces more energy than glucose, but less oxidative stress, so the brain and the muscles work more efficiently. This effect of ketone bodies as energetic boosters is very important in migraine patients, or migraineurs, because they have an energetic deficit in the brain. Ketone bodies also have an anti-inflammatory effect.
~ Bengsch, D. 
Yes they do.
Metabolic breakdown of carbohydrates has been shown in studies to increase inflammatory markers of CRP which is nonspecific inflammatory measures your doctor can check for you.
This way of eating keto also reduces glutamate which can lead to migraines.
Yes, but it’s still emerging. Low carb evidence is strong in obesity and epilepsy. But in terms of migraine, one study with mice showed slowing down the cortical spreading depression – mimicking the anti-epileptic medications.
A third of his patients are getting good results.
When people in general eat carbohydrate, it shoots up insulin really high – having high insulin circulating in body builds up resistance. The exact mechanism is still not totally understood. Insulin resistance = type 2 diabetes.
One way to keep the body sensitive to insulin is via exercise (strengthening, moves lymphatic system, creates endorphins, and helps your own body fight pain). Exercise also reduces anxiety.
Another way to keep body insulin sensitive is to eat less insulin… when you eat. He gave this example:
The role of insulin is to store energy. In the muscles first, and then in fat. You need to access your insulin levels by accessing your fat stores.
Reduce sugar? Yes – any peak and valley is horrible for a migraine sufferer. The body likes routine. Sleep, eat and drink coffee at the same time every day. Keep your energy as even as possible. Carbohydrates spike it more than protein and fat.
Eat foods high in magnesium – seeds, nuts, and green vegetables tend to be high in magnesium.
And just to be clear... chocolate is part of a low carb, ketogenic diet!
So, can a keto diet help with migraines? Think of it as a way of living, not a diet, keep yourself inspired, and stay inspired. He tells his patients this doesn’t have to be forever. Once the migraines are better controlled, they can pull off the diet, and then try again. This can be used as another tool in your toolbox.
If you get a migraine from too many carbs… what will you do to manage the attack? The end goal is to get the migraine better controlled however we get there!
Can a keto diet help with migraines?
If you get a migraine attack every time you eat too many carbs... this diet could be your answer.
I’ve just briefly highlighted his talk; you can hear more when the summit livestreams in March every year or buy the package any time of year. You won't get this kind of education anywhere else... here's the link...
WANT MORE TIPS? Subscribe to my newsletter and follow along on Facebook, Pinterest and Instagram for all of the latest updates.
Can a keto diet help with migraines reference:
1. Moreno, A. NP. (2019) Can a Ketogenic Diet Prevent Migraines? Available [online] at: https://www.migrainesavvy.com/summit
2. Bengsch, D. (2016) Less carbs, more fat: ketogenic diet makes migraine patients' headaches disappear. Available [online] at: https://www.researchgate.net/blog/post/less-carbs-more-fat-ketogenic-diet-treats-migraine-patients