Preheat your oven to 375°F (190°C) and lightly grease a casserole dish.
Boil the sweet potato cubes in a large pot of salted water until tender, about 10-15 minutes. Drain and set aside.
In a mixing bowl, combine the cooked sweet potatoes, shredded cheddar cheese, diced bacon (if using), sour cream, and chopped green onions. Season with salt and pepper to taste.
Transfer the mixture to the prepared casserole dish and spread it out evenly.
Bake in the preheated oven for about 20-25 minutes, or until the cheese is melted and the casserole is heated through.
Remove from the oven and let it cool for a few minutes before serving.
Garnish with additional chopped green onions and a dollop of sour cream if desired, and enjoy!