Testing is the way to go. We can give you lots of tips about what works for us (and I'll give mine below) but ultimately everybody's diabetes is different, and you'll have to find what mostly works for you. That means trial and error, so if you plan for the worst, you'll be all right. Take more food than you think you might need (and/or money to buy more) as well as a source of fast-acting carbs (like glucose tablets).
Take a few notes to record what you do, such as changes in basal rates (if you're on a pump) and how much you ate and how long you rode. Then tweak it until *you* are happy with it.
Here's what mostly works for me now. When I ride in the morning--which is easiest for me--I lower my basal to about 60% of normal about 1-1.5 hours before I head out. Then about 15 minutes before the ride I eat something with a lot of protein and about 20g of carbs (yoghurt). During the ride, I eat about 20-30g of carb (gel/banana/Clif Bar/etc.) every 30-40 minutes. I don't usually bolus for any of the food before or during the ride, and this keeps me pretty stable.
And then I need some insulin right after I finish a ride to keep my BG from shooting way up. That's me.
As for CGM, it's great most of the time, but I find mine to be rather unreliable when I'm on the bike. So just keep in mind that it's not a substitute for testing when you're riding.
And most importantly, HAVE FUN!!