01 - Preheat oven to 375°F. Lightly grease a 9x13-inch baking dish with butter.
02 - Place 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 thinly sliced onions and sauté, stirring occasionally, until golden brown and deeply caramelized, about 15 to 20 minutes. Add minced garlic and cook for 1 additional minute.
04 - Mash the drained potatoes together with butter, warm milk, sour cream, salt, and pepper until smooth and creamy.
05 - Stir half of the cheddar and mozzarella cheeses into the mashed potatoes, then gently fold 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. Top with the remaining cheddar and mozzarella cheeses and any reserved caramelized onions.
07 - Bake for 25 minutes, or until the cheese is melted and bubbly with lightly golden spots on top.
08 - Garnish with fresh chives if desired. Serve hot.