Image > Flatten Layer Groups
Does exactly what you expect it to do. Every top-level layer group is merged (careful: only visible layers in each layer group are merged). The layer tree becomes completely flat. Why is this useful? Well, I made it because it is impossible to convert an image to Indexed mode or export it as animated GIF if it contains any layer groups. And layer groups are extremely useful for animated GIFs. It's a conundrum! And this script helps automate the process somewhat.