At one stage I was somewhat of a caffeine addict (coffee, pills and "energy" drinks, more a product of bad habits in student years leading to worse habits while working in the business world. When I say addict, I mean 2-3g of caffeine per day, not just "I frequently enjoyed coffee". At the same time, I was also a main-liner of high sugar foods (also not that healthy and probably not that effective for energy - luckily even then I still had a relatively fast metabolism).
I eventually got off the caffeine and fairly dramatically reduced the sugar. I much later re-introduced some caffeine at lower levels from safer sources (green tea, cacao) and further reduced refined sugar to almost exactly zero, but a "reasonable" (and variable) amount from fruit, including high glucose fruit.
I did get real headaches, from any sudden reduction in caffeine intake, even when quite well hydrated. I got more acute headaches from crashing off sugar, but caffeine was much harder to give up overall. I haven't had these related headaches for a long time, and I rarely get even mild headaches now, usually only if the air pressure is very low or I am not properly hydrated AND I have stuffed up my sleep the previous day or two, e.g. a shift change. Maybe one of the many benefits of green tea over coffee is you really don't need the sugar.
To anyone giving up a lot of caffeine, I would say (anecdotally of course) go cold turkey if and only if you have 2-3 days where you can afford to be quite unproductive, and have a supply of paracetamol on hand. For lower amounts, it's probably not that drastic.