In the operas of Lully these 'divertissements' were sometimes linked to the main plot, or performed at the close of the performance.
The term is used in music to refer generally to a work evocative of pastoral or rural life such as Edward MacDowell's Forest Idylls, and more specifically to a kind of French courtly entertainment (divertissement) of the baroque era where a pastoral poem was set to music, accompanied by ballet and singing.
The era is typically considered to have begun with the 1827 début in Paris of the ballerina Marie Taglioni in the ballet La Sylphide, and to have reached its zenith with the premiere of the divertissement Pas de Quatre staged by the Ballet Master Jules Perrot in London in 1845.