01 - Preheat oven to 375°F. Lightly grease a 9x13-inch baking dish with butter.
02 - Place the peeled and cubed potatoes in a large pot of salted water. Bring to a boil, then reduce heat and simmer until fork-tender, about 15 to 18 minutes. Drain thoroughly.
03 - While the potatoes cook, heat olive oil in a large skillet over medium heat. Add the sliced onions and sauté, stirring occasionally, until deeply golden and caramelized, about 15 to 20 minutes. Stir in the minced garlic and cook for 1 additional minute.
04 - Mash the drained potatoes together with the butter, warm milk, sour cream, salt, and black pepper until smooth and creamy.
05 - Fold half of the cheddar and mozzarella cheeses into the mashed potatoes, then gently stir in the caramelized onions. Reserve a few tablespoons of onions for the topping if desired.
06 - Spread the potato mixture evenly in the prepared baking dish. Scatter the remaining cheddar and mozzarella over the top, along with any reserved caramelized onions.
07 - Bake for 25 minutes, or until the cheese is melted, bubbly, and lightly golden in spots.
08 - Garnish with fresh chives if desired. Serve hot.