Caffeine can influence how often you get migraines and how severe they are. The surprising thing is that you're more likely to get a headache after the caffeine wears off, not while you're drinking caffeinated beverages or eating foods that contain caffeine. Some people, for instance, drink caffeinated beverages only during the week, so switching to decaffeinated beverages on the weekend may trigger a headache. If you usually drink caffeine during the week, try to drink the same amount at the same time over the weekend. Drinking no more than 2 cups of caffeinated beverages per day may also help.
If you want to cut back on caffeine or eventually give it up all together, do so gradually. You might mix decaffeinated beverages with caffeinated ones, gradually increasing the amount of decaffeinated drink until you are only drinking decaffeinated beverages. This will give you the best chance of cutting back or giving up caffeine without getting a headache.